catching 408 response from upstream server

Frederik Nosi frederik.nosi at
Tue Feb 10 12:19:13 UTC 2015

On 02/10/2015 08:35 AM, shmulik wrote:
> Hi,
> I'm using nginx as reversed proxy, using the proxy module.
> Whenever i get a response code >= 400 from the upstream server, i'm
> redirecting the client to a different url.
> This is the configuration i use (simplified):
>          location ~ "^/proxy/host_(.*)/fallback_(.*)" {
>              proxy_pass http://$1;
>              proxy_intercept_errors on;
>              error_page 404 408 500 http://$2;
>          }
> However, i've noticed that when the upstream server responds with 408
> response code, nginx does not send a redirect.
> Instead it terminates the connection to the client.

I think this is because of the nature of 408 error. It means the client 
is slow, (or slowloris). Probably the only sane thing to do in that case 
is to drop with an error. Though, looking at the documentation it seems 
you can configure when a request is slow with this directives:


Check her e for more details:


> Is this the intended behavior?
> Is there any way around it?

See above
> I'd like to be able to intercept 408 responses as well and redirect them.
> Any alternative suggestions to implement it are very welcome.
> Thanks in advance,
> Shmulikb
> Posted at Nginx Forum:,256530,256530#msg-256530
> _______________________________________________
> nginx mailing list
> nginx at


More information about the nginx mailing list