The docs say:
When the custom-http-errors option is enabled, the Ingress controller configures NGINX so that it passes several HTTP headers down to its default-backend in case of error: https://kubernetes.github.io/ingress-nginx/user-guide/custom-errors/
I have healthchecks on my services, and want a custom error page to be shown if the healthcheck fails and the service is offline, rather than the default rather terse Nginx one.
I have a default backed configured, and with: custom-http-errors: "503"
this works. Without this line, the default Nginx page is shown.
However, if the backend service healthchecks are OK (i.e. "ready"), but the service itself returns a 503 page for any reason, Nginx intercepts this, and also then redirects the client to the default backend, rather than just returning the page to the client like normal.
The docs say:
Setting at least one code also enables proxy_intercept_errors which are required to process error_page.
Which isn't what I want.
So is there any way to have a friendly custom response when the service is broken and the healthchecks checks have failed, without also intercepting legitimate 503 responses from the service?
The same issue applies to 404. I want the ingress to return a friendly 404 page if someone attempts to access a non-existent service, without also intercepting a 404 response from a valid service.