Intercepted 400 errors not displaying custom error page

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!

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.

My solution was to enable recursive_error_pages

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