HTTP-to-HTTPS redirect for external HTTP(S) GCP load balancers


One of my friends said when she typed only the domain name instead of clicking the link in browser, she got the 404 NOT FOUND message of Google, sometimes I also had that error.

I am a bit confused at first, and both of my friends lg and sh pointed out that I should enable port 80 redirection to port 443.


Life . . .

Without much experience in site building, I did a lot of search in the Internet, and came across this:

However, after some trials, I failed, the dumb .htaccess file is useless.

Suddenly, I thought it might be the problem of load balancer, because that layer is before the server, then finally I found the correct information to set it up. yay!


Basically, the solution is to create another front-end only GCP load balancer to forward the 80 traffic to my previous 443 load balancer. Interesting.



Now I managed to provide better user experience…❥(^_-)

If wanna get more clients' information from GCP load balancer…

The solution is here: Creating custom headers

Custom request and response headers allow you to specify additional headers that the external HTTP(S) load balancer adds to requests and responses.