How do I configure the Google Cloud Platform Ingress to serve a static page if the backend health check fails?

9/24/2019

I have a website running on GCP Kubernetes. It uses an Ingress to receive traffic initially and is then passed down to a Deployment/Workload.

If for some reason the backend health check fails, we receive a generic 500 status page. I would like to serve a more stylish version of that page for consumers. Ideally we'd tune the system so this won't happen, but sometimes it still occurs.

Default Server Error Page

-- caspertm
google-cloud-platform
google-kubernetes-engine
kubernetes-ingress

1 Answer

9/25/2019

No such feature exists as of now in the GCLB to do that. You can always use your own ingress controller like Nginx and set-up the following configuration:

error_page 500 502 503 504 /custom_50x.html;
        location = /custom_50x.html {
                root /usr/share/nginx/html;
                internal;
        }
-- Kunal Deo
Source: StackOverflow