# Disable error page for one location?

**URL:** <https://www.ruby-forum.com/t/disable-error-page-for-one-location/217530>\
**Category:** NGINX\
**Created:** [March 4, 2012, 10:14am UTC](https://www.ruby-forum.com/t/disable-error-page-for-one-location/217530 "2012-03-04T10:14:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [March 4, 2012, 10:14am UTC](https://www.ruby-forum.com/t/disable-error-page-for-one-location/217530/1 "2012-03-04T10:14:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nicholas\_Sherlock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@Nicholas\_Sherlock](https://www.ruby-forum.com/u/Nicholas_Sherlock)\
**Post date:** [March 4, 2012, 10:36am UTC](https://www.ruby-forum.com/t/disable-error-page-for-one-location/217530/2 "2012-03-04T10:36:16Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Nicholas\_Sherlock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@Nicholas\_Sherlock](https://www.ruby-forum.com/u/Nicholas_Sherlock)\
**Post date:** [March 4, 2012, 12:01pm UTC](https://www.ruby-forum.com/t/disable-error-page-for-one-location/217530/3 "2012-03-04T12:01:50Z")

</div>

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
