2 messages in ru.sysoev.nginxRe: Can error_pages be used to interc...
FromSent OnAttachments
Yusuf GoolamabbasJun 14, 2006 9:44 pm 
Igor SysoevJun 15, 2006 10:20 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Can error_pages be used to intercept a 404 response from an upstream backendActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Jun 15, 2006 10:20:50 pm
List:ru.sysoev.nginx

On Thu, 15 Jun 2006, Yusuf Goolamabbas wrote:

Hi, I have been able to use error_page for error code 502,503,504 when nginx is used as a reverse proxy. Is it possible to use error_page to handle 403,404 responses from the upstream and replace it with an error_page specifed in nginx

I tried to use the following

error_page 404 /40x.html; location /40x.html { root /tux/ ; }

But when I request the URL (which doesn't exist), I get the response generated by the upstream backend server

The corresponding stanza for 50x codes work correctly (when the upstream backend is not answering)

error_page 502 503 504 /50x.html; location /50x.html { root /tux/ ; }

You should set "proxy_redirect_errors on" for proxied locations:

location / { proxy_redirect_errors on; proxy_pass ... }