Disable error page for one location?

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

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 D. [email protected]

On 4/03/2012 6:35 p.m., Francis D. 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs