I'm using nginx as a reverse-proxy over my existing web server. I only want to manage a single set of custom error pages, and ideally within nginx as this is the level closest to the client.
Now I'm fine with using the error_pages
and proxy_intercept_errors
settings. However:
In the case of 400 (Bad Request) errors I need the underlying web server to be able to through some JSON body content, detailing why the request was bad. And so I need a way of disabling
proxy_intercept_errors
for 400 status codes only.I never want to show the default nginx error pages, for any status code. Now from what I can see, in order to achieve this I would need to explicitally list out every possible status code imaginable, and have an error page for it? Rather than just wildcarding all errors above 500 for example.
My questions are - Are the above 2 issues resolvable within nginx itself? If not, is there an obvious solution to the issues above?