Disable error page for one location?

10 views
Skip to first unread message

Nicholas Sherlock

unread,
Mar 4, 2012, 4:13:48 AM3/4/12
to ng...@nginx.org
Hi everyone,

I'm using Nginx to proxy to an Apache backend. The backend generates a wide
variety of ugly 404- and 500-code error messages that I don't really want to
show to the end-user, so in my server block I've got:

proxy_intercept_errors on;
error_page 500 502 503 504 /error/500.html;
error_page 400 /error/404.html;

The backend scripts in one of my locations generate useful 404 (but not 500)
messages that I want to pass through to the client. How can I pass through
just 404 errors in one particular location from my backend to the client?

Thanks,
Nicholas Sherlock

_______________________________________________
nginx mailing list
ng...@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Francis Daly

unread,
Mar 4, 2012, 4:35:29 AM3/4/12
to ng...@nginx.org
On Sun, Mar 04, 2012 at 09:13:48AM +0000, Nicholas Sherlock wrote:

Hi there,

> proxy_intercept_errors on;
> error_page 500 502 503 504 /error/500.html;
> error_page 400 /error/404.html;
>
> The backend scripts in one of my locations generate useful 404 (but not 500)
> messages that I want to pass through to the client. How can I pass through
> just 404 errors in one particular location from my backend to the client?

Untested, but:

"error_page" determines which response codes are *not* passed through as-is.

And directive values between levels are generally inherited or replaced,
but not added.

So, in the location you care about, repeating your server-level error_page
directives without the 404 one, should Just Work.

f
--
Francis Daly fra...@daoine.org

Nicholas Sherlock

unread,
Mar 4, 2012, 6:01:19 AM3/4/12
to ng...@nginx.org
On 4/03/2012 6:35 p.m., Francis Daly wrote:
> "error_page" determines which response codes are *not* passed through as-is.
>
> And directive values between levels are generally inherited or replaced,
> but not added.
>
> So, in the location you care about, repeating your server-level error_page
> directives without the 404 one, should Just Work.

That works, thanks!

Cheers,
Nicholas Sherlock

Reply all
Reply to author
Forward
0 new messages