0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Return HTTP 504 when FastCGI connect times out.

This commit is contained in:
ericdreeves 2016-12-03 16:31:29 -06:00
parent 5874fbeb7e
commit 9f16ac84a0

View file

@ -81,6 +81,9 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
// Connect to FastCGI gateway // Connect to FastCGI gateway
fcgiBackend, err := rule.dialer.Dial() fcgiBackend, err := rule.dialer.Dial()
if err != nil { if err != nil {
if err, ok := err.(net.Error); ok && err.Timeout() {
return http.StatusGatewayTimeout, err
}
return http.StatusBadGateway, err return http.StatusBadGateway, err
} }
defer fcgiBackend.Close() defer fcgiBackend.Close()