Reputation: 7932
I have a nginx/nodejs stack.
My nginx is configured to serve a static 502 error page when my nodejs process is down.
Now, i want to have my nodejs to run normally, and occasionally throws a 502 to nginx, to trigger the static 502 page on some user requests. How do i do that?
I tried to throw some errors in my node process without catching them, but it results in the error stack being passed directly to the client browser.
Upvotes: 2
Views: 156
Reputation: 9343
Add this to your proxy config:
proxy_intercept_errors on;
As per the manual:
Determines whether proxied responses with codes greater than or equal to 300 should be passed to a client or be redirected to nginx for processing with the error_page directive. Default off
Upvotes: 3