multihop 502s

Adam Wiggins adam at heroku.com
Tue May 13 09:03:55 MSD 2008


Hello all,

I've been trying to get Nginx to do multiple hops on error page
failovers.  Like a cache miss on memcache (404) followed by a bad
gateway on the main server ending up at a fallback server.  Here's a
simplified example:

location / {
    memcached_pass 1.2.3.4:11211;
    error_page 404 502 = @main;
}

location @main {
    error_page 502 = @fallback;

    proxy_pass http://main_server;
    break;
}

location @fallback {
    proxy_pass http://fallback_server;
    break;
}

However, the second 502 doesn't get triggered, it just shows the
standard Nginx 502 page.  It works as expected when the first hop
(memcache) is removed.

Is a multi-hop 502 possible?

Adam





More information about the nginx mailing list