# Max\_fails includes read\_timeout even if timeout is excluded from proxy\_next\_upstream

**URL:** <https://www.ruby-forum.com/t/max-fails-includes-read-timeout-even-if-timeout-is-excluded-from-proxy-next-upstream/212111>\
**Category:** NGINX\
**Created:** [September 22, 2011, 1:34pm UTC](https://www.ruby-forum.com/t/max-fails-includes-read-timeout-even-if-timeout-is-excluded-from-proxy-next-upstream/212111 "2011-09-22T13:34:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [September 22, 2011, 1:34pm UTC](https://www.ruby-forum.com/t/max-fails-includes-read-timeout-even-if-timeout-is-excluded-from-proxy-next-upstream/212111/1 "2011-09-22T13:34:28Z")

</div>

Hi,

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  
keys\_zone=tptest:10m;

upstream tptestBackend  
{  
server tp.dev.infinity.local max\_fails=1 fail\_timeout=30s;  
server dn.dev.infinity.local max\_fails=1 fail\_timeout=30s;  
}

server  
{  
listen 172.16.0.64:80;  
server\_name tp.nginx.dev.infinity.local;

```
    proxy_cache tptest;
    proxy_set_header Host 'tp.dev.infinity.local';
    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  
http\_504;  
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?

Thanks

Posted at Nginx Forum:

> **[max\_fails includes read\_timeout even if timeout is excluded from...](https://forum.nginx.org/read.php?2,215585,215585#msg-215585)**
>
> Hi, 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/n
