I currently have a setup where I have 3 upstream sets (directives?), and
it will fallback in a chain. So if it gets a 404 from setA, it’ll go to
setB. If setB also has a 404, then setC. The config is:
upstream setA {
server ipA:port
}
upstream setB {
server ipB:port
}
upstream setC {
server ipC:port
}
server {
listen 80;
server_name localhost;
#SetAHandler
location /
{
access_log logs/access.log main;
error_page 404 502 503 504 = @SetBHandler;
proxy_intercept_errors on;
proxy_pass http://setA;
proxy_set_header Host $host;
proxy_connect_timeout 60s;
proxy_next_upstream error timeout http_500 http_502 http_503
http_504 http_404;
# proxy_cache nginx_cache;
# proxy_cache_valid 200 304 12h;
# expires 1d;
# break;
}
location @SetBHandler
{
access_log logs/access.log main;
proxy_intercept_errors on;
error_page 404 502 503 504 = @SetCHandler;
proxy_pass http://setB;
proxy_set_header Host $host;
proxy_connect_timeout 60s;
proxy_next_upstream error timeout http_500 http_502 http_503
http_504 http_404;
# proxy_cache nginx_cache;
# proxy_cache_valid 200 304 12h;
# expires 1d;
# break;
}
location @SetCHandler
{
access_log logs/access.log main;
proxy_pass http://setC;
proxy_set_header Host $host;
proxy_connect_timeout 60s;
proxy_next_upstream error timeout http_500 http_502 http_503
http_504 http_404;
#Last proxy, return whatever it gives
proxy_intercept_errors off;
# proxy_cache nginx_cache;
# proxy_cache_valid 200 304 12h;
# expires 1d;
# break;
}
The problem is, it only seems to check setA and setB, and bypasses setC
completely. I tested it by putting a file on the third IP in setC that
wasn’t in setA or setB. Whenever I hit Nginx, it always returns 404,
when the expected behavior is for it to return the file at ipC.
I have it logging th $upstream_addr, and everytime it 404s, the logs
always show:
:
Is there some directive from the HttpProxyModule that limits it to 2 by
default?
Posted at Nginx Forum: