Directive proxy_next_upstream doesn't work?

nginx conf is:

http {
large_client_header_buffers 8 8k;

proxy_buffers 8 8K;
proxy_buffer_size 8K;

open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

upstream backend {
server 10.10.2.100:8088 max_fails=200 fail_timeout=10;
server 10.10.2.101:8088 max_fails=200 fail_timeout=10;
server 10.10.2.102:8088 max_fails=200 fail_timeout=10;
server 10.10.2.103:8088 max_fails=200 fail_timeout=10;
}

server {
listen 80;
server_name _;
keepalive_timeout 60;
proxy_set_header Host $http_host;

proxy_connect_timeout 10;
proxy_read_timeout 10;
proxy_next_upstream error http_500 http_502 http_503
http_504;
add_header P3P “CP=CAO PSA OUR”;
add_header Cache-Control
“must-revalidate,no-cache,private”;

location / {
proxy_pass http://backend;
}
}
}

On my production, in the cases a server of upstream response http_504,
but the request doesn’t to be transmitted to the next server, nginx
response http 504 to client.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220648,220648#msg-220648

My ngx is last stable version.
centos 5.4 x86_64

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220648,220649#msg-220649

Hello!

On Thu, Dec 29, 2011 at 02:45:42AM -0500, defage wrote:

open_file_cache_min_uses 2;
server {
add_header Cache-Control
response http 504 to client.
A request is passed to a next server only if not all (alive)
upstream servers were tried yet. Otherwise response from last
tried server will be returned.

Maxim D.

you mean at that moment all of upstream server has to tried,and it
reponse 504? but at that moment only one app server’s log throw error
info.
A part of access_log like:
10.001 10.001 /cas/login 10.10.2.100:8080 504
10.001 10.001 /cas/login 10.10.2.100:8080 504

If pass to all servers, the log is like below:?
10.001 10.001 /cas/login 10.10.2.100:8080, 10.10.2.101:8080,
10.10.2.102:8080, 10.10.2.103:8080 504

the problem is my app server 's log show ,at that moment only one server
of upstream have 504 error.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220648,220659#msg-220659

Hello!

On Thu, Dec 29, 2011 at 04:07:41AM -0500, defage wrote:

the problem is my app server 's log show ,at that moment only one server
of upstream have 504 error.

It looks like you are trying to handle timeouts, not 504 returned
by an upstream server. You have to specify “timeout” in
proxy_next_upstream directive, not “http_504”.

Or better just remove the proxy_next_upstream directive from your
config, default value “error timeout” is good enough in most
cases.

Maxim D.