Welcome! Log In Create A New Profile

Advanced

404 fallback only hitting 2/3 upstream sets

August 07, 2012 12:55PM
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:

<ipA> : <ipB>

Is there some directive from the HttpProxyModule that limits it to 2 by default?
Subject Author Posted

404 fallback only hitting 2/3 upstream sets

helliax August 07, 2012 12:55PM

Re: 404 fallback only hitting 2/3 upstream sets

helliax August 07, 2012 01:15PM

Re: 404 fallback only hitting 2/3 upstream sets

Maxim Dounin August 08, 2012 06:32AM

Re: 404 fallback only hitting 2/3 upstream sets

helliax August 08, 2012 12:35PM

Re: 404 fallback only hitting 2/3 upstream sets

Maxim Dounin August 08, 2012 12:52PM

Re: 404 fallback only hitting 2/3 upstream sets

helliax August 08, 2012 12:55PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready