I need my nginx front-end to return 204 when the back-end reply a 5xx or timeout.
Is it possible?
Thanks
Okay, finally I used:
location @return_204 {
return 204;
}
location / {
proxy_pass http://zzz;
proxy_intercept_errors on;
error_page 500 502 503 504 = @return_204;
}
You can use the error_page directive to achieve this. Not that you would also need to set proxy_intercept_errors to make Nginx process the errors.
location / {
...
proxy_intercept_errors on;
error_page 500 502 503 504 =204;
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With