Two jumps using error_page directive

Hi all,

I have problem using error_page directive, here is main part of
problematic config:

upstream test {
  server localhost:2009;
}

upstream test2 {
  server localhost:2010;
}

server {
  listen 80;

  location / {
    proxy_pass http://test;
    error_page 404 500 502 = @fail;
  }

  location @fail {
    proxy_pass http://test2;
    error_page 404 500 502 /50x.html;
  }

  location = /50x.html {
    internal;
    root /var/www/nginx-default;
  }
}

<<<<<

This is of course minimal config with the same problem I have in more
complicated scenario.

Here is my case: assume both test and test2 upstreams are dead. I want
to see nice static page with error explanation (/50x.html) but this is
not working. Instead, I see standard nginx 502 error. So only first
error_page directive caused jump to @fail location but then 502 didn’t
cause second jump to /50x.html. Why?

I hope everything is clear enough :slight_smile:

Cheers,


Kamil

Hello!

On Tue, Jan 12, 2010 at 02:19:27PM +0100, Kamil G. wrote:

upstream test2 {

<<<<<

This is of course minimal config with the same problem I have in more
complicated scenario.

Here is my case: assume both test and test2 upstreams are dead. I want
to see nice static page with error explanation (/50x.html) but this is
not working. Instead, I see standard nginx 502 error. So only first
error_page directive caused jump to @fail location but then 502 didn’t
cause second jump to /50x.html. Why?

http://wiki.nginx.org/NginxHttpCoreModule#recursive_error_pages

Maxim D.