return 504 status for timeout errors

modify custom TimeoutHandler to return 504 error and switch imageproxy
to use that func.

Fixes #75
This commit is contained in:
Will Norris 2016-11-29 15:39:59 -08:00
parent e180185856
commit 576b7c023a
2 changed files with 4 additions and 3 deletions

View file

@ -32,6 +32,7 @@ import (
"github.com/golang/glog"
"github.com/gregjones/httpcache"
tphttp "willnorris.com/go/imageproxy/third_party/http"
)
// Proxy serves image requests.
@ -105,7 +106,7 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var h http.Handler = http.HandlerFunc(p.serveImage)
if p.Timeout > 0 {
h = http.TimeoutHandler(h, p.Timeout, "")
h = tphttp.TimeoutHandler(h, p.Timeout, "Gateway timeout waiting for remote resource.")
}
h.ServeHTTP(w, r)
}