multihop 502s

Igor Sysoev is at rambler-co.ru
Tue May 13 09:21:53 MSD 2008


On Mon, May 12, 2008 at 10:03:55PM -0700, Adam Wiggins wrote:

> 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;

-     break;
+     recursive_error_pages  on;

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

-     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?

Use "recursive_error_pages on".
Also "break"s are useless here and only waste CPU cycles.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list