Max_fails includes read_timeout even if timeout is excluded from proxy_next_upstream


I am having some trouble with the latest stable of Nginx’s proxy
upstream support.

I would like Nginx to NOT count read timeouts towards the max_fails in
the upstream definition.

Here is what I have:

proxy_cache_path /var/cache/nginx/tptest levels=1:2

upstream tptestBackend
server max_fails=1 fail_timeout=30s;
server max_fails=1 fail_timeout=30s;


    proxy_cache             tptest;
    proxy_set_header        Host '';
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_cache_key         http://$host$request_uri;
    proxy_connect_timeout   1;
    proxy_cache_use_stale   error timeout updating invalid_header

http_500 http_502 http_503 http_504;
proxy_next_upstream error http_500 http_502 http_503
proxy_read_timeout 5;

    location /
            proxy_pass      http://tptestBackend;


I have removed “timeout” from the proxy_next_upstream directive, however
when I try with a script that sleeps forever, the timeout kicks in, but
it does count towards the max_fails, and so next time only the second
server is used.

Is this a bug?


Posted at Nginx Forum:,215585,215585#msg-215585

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs