Google Cloud LB: change the default server error html page

By default, if the load balance cannot find the backend for traffic redirection, for example, if all available backends are omitted, it displays this html page:

enter image description here

Transcript:

Error: server error

The server detected a temporary error and could not fulfill your request. Try again after 30 seconds.

Instead, I would like to use my own static HTML page. I saw this on the LB + Cloud storage page here :

You can also configure a custom index page and a custom error page that will be serviced if the requested object does not exist. This can be done by adding the website configuration to the Cloud Storage bucket. With a website configuration, you can serve a static web page directly from a cloud storage bucket from your own domain.

How will it work? I know how to host a static page in cloud storage, but how to use it with LB?

+3
source share
1 answer

Simply put, you cannot , at least for now.

The cloud load HTTP balancer you found is in alpha, you need to ask for a whitelist to try. But this will not solve your problem. Since there is currently no way to control the load balancing redirection manully based on backend responses. I do not think it will be possible. This is not the goal of load balancing in GCP.

You can also configure a custom index page and a custom error page that will be serviced if the requested object does not exist.

The above statement means that you can create a custom 404 page for unreasonable objects in a bucket. This does not mean that you redirect traffic if your back services do not work (502). There is a big difference between: I cannot find the page, and nothing works because I do not have a server.

You can only redirect traffic from outside to inside your network. You cannot do the opposite. You cannot request load balancing overload based on response.

Instead of trying to make the 502 error page look beautiful, ask yourself why you have it and try to fix it.

+1
source

Source: https://habr.com/ru/post/1260550/


All Articles