Google Cloud HTTPS Loadbalance, how to force http to https
i have activated a HTTPS loadbalancer on GCP, with SSL certificate. On fronted i have specified HTTPS/443 as listening protocol and HTTP to comunication with backend.
https it working nicely, but loadbalancer also accept http/80 connection resulting in a 404 page.
Is there any way to forward http to https directly from loadbalancer?
thank you
Solution 1:
Just create a second forwarding rule on the load balancer for port 80. Both will use the same backend service.
If you want to forward users from http to https then you can't do this from the load balancer. You will have to set this up in your backend service. You can find more details here: https://stackoverflow.com/questions/38201969/redirecting-http-to-https-in-google-cloud/38202272
Solution 2:
Create a static global IP address first
An Ephemeral IP
or a static IP belong to any region
doesn't work for the GCP HTTP(S) load balancer
because it handles an IP to only a port. You can set a static global IP
to both ports 80/443 on your load balancer.
I'm guessing a possible reason is that GCP load balancer doesn't belong to any region.