# Intercepted 400 errors not displaying custom error page

**URL:** <https://www.ruby-forum.com/t/intercepted-400-errors-not-displaying-custom-error-page/212367>\
**Category:** NGINX\
**Created:** [September 30, 2011, 10:13pm UTC](https://www.ruby-forum.com/t/intercepted-400-errors-not-displaying-custom-error-page/212367 "2011-09-30T22:13:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [September 30, 2011, 10:13pm UTC](https://www.ruby-forum.com/t/intercepted-400-errors-not-displaying-custom-error-page/212367/1 "2011-09-30T22:13:02Z")

</div>

I am trying to intercept errors from a Unicorn proxy\_pass and display a  
custom 40x error page that is located on disk. This is what a subscript  
of my config:

proxy\_intercept\_errors on;  
error\_page 400 403 =404 /404.html;  
location /404.html {  
allow all;  
internal;  
}

When I receive a 403 error from NGINX it is passing to the location and  
rendering the 404.html error page in my root. When the upstream returns  
a 400 response NGINX is intercepting it but not rendering the 404.html  
file, instead it returns the generic NGINX 400 error response page.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![jamiew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f04885/32.png) [@jamiew](https://www.ruby-forum.com/u/jamiew)\
**Post date:** [September 30, 2011, 10:15pm UTC](https://www.ruby-forum.com/t/intercepted-400-errors-not-displaying-custom-error-page/212367/2 "2011-09-30T22:15:41Z")

</div>

Update: It seems that all response codes I specify in error\_page are  
intercepted by NGINX but do not pass to the /404.html location to render  
the custom error page.

---

<div class="post-metadata">

**Author:** ![jamiew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f04885/32.png) [@jamiew](https://www.ruby-forum.com/u/jamiew)\
**Post date:** [September 30, 2011, 10:31pm UTC](https://www.ruby-forum.com/t/intercepted-400-errors-not-displaying-custom-error-page/212367/3 "2011-09-30T22:31:06Z")

</div>

My solution was to enable recursive\_error\_pages
