error_page x 2?

Igor Sysoev is at rambler-co.ru
Tue Dec 18 10:22:24 MSK 2007


On Mon, Dec 17, 2007 at 11:08:43PM -0800, Eden Li wrote:

> Can you intercept errors twice?  I tried something like the following,
> but it still serves the nginx 404 page.  Is there a better way?

Yes, "recursive_error_pages  on".

> server {
>   root /data;
> 
>   error_page 404 = /fetch$uri;
> 
>   location /fetch {
>     internal;
>     proxy_pass http://backend;
>     proxy_intercept_errors on;
>     alias /data;
>     error_page 404 /404.html;
>   }
> }

Use the following configuration:

     location / {
         root /data;
         error_page 404 = @fetch;
     }

     location @fetch {
         internal;

         proxy_pass http://backend;
         proxy_intercept_errors on;

         recursive_error_pages  on;
         error_page 404 /404.html;
     }


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





More information about the nginx mailing list