How to redirect http to https on GCP without another load balancer?

442 views
Skip to first unread message

Ray Giarratana

unread,
Jun 22, 2021, 3:01:53 AM6/22/21
to Google Cloud Developers

I have several simple sites (mostly single bucket sites, and one LAMP site) and it seems that I need 2 load balancers per site. One for the https backend and certificate, and another to redirect http traffic to https.

GCP charges way too much for load balancers (about $18/month each) and this seems excessive for simple websites.

Is there any other way around this?

Does everyone redirect http to https? Or can I just not have it and expect everyone to go to the https site?

AWS has ALIAS records in Route53 that were perfect for this, but alas, GCP does not have ALIAS records in Cloud DNS.

I read somewhere that it's possible to use one load balancer for multiple backends but I have no idea how to implement that if true.

Roberto Carbajales di Cosola

unread,
Jun 23, 2021, 5:08:45 AM6/23/21
to Google Cloud Developers
Hello,

I understand that you want to use only one load balancer to forward the traffic to the different back-ends that you want, I will assume that all the back are in the same instance group for now. 

For the SSL load balancer that cannot be done according to this documentation [1], but you can use the HTTPS load balancer ans setting the appropriate forwarding rules [2] to redirect traffic to the different back-end services.

If you want to redirect traffic to different ports within the same intance group, the recommended way to set this up is using the same Instance Group for multiple backends and setting different port names for your forwarding rules.

I hopes this helps you.
Best regards.

-----
Reply all
Reply to author
Forward
0 new messages