How to Redirect Http to Https Using Gcp Load Balancer

Static Website Redirect HTTP to HTTPS with GCP Load Balancer with

A little late, but Google added a fix for the issue.

https://issuetracker.google.com/issues/35904733

Redirect to HTTPS using Google Cloud Load Balancer with two IP-s

This is what I found out.

It's a common problem a lot of people have, take a look at this issue thread where people are requesting an easier way to set this up.

https://issuetracker.google.com/issues/35904733

I fixed this by setting up static IP instead of the ephemeral IP for HTTP and HTTPS frontends. This way they both have the same IP and the redirect inside your node app or nginx works as it should.

Support only https in Load Balancer

Seems like you are using GKE, so this setup might be different.

On your Ingress you must use the following annotation as per doc

kubernetes.io/ingress.allow-http: "false"

This will tell GCP to only use HTTPS when creating your Load Balancer, please note that this (as per today) will only work when creating your Ingress deployment, if you edit this onto an existing Ingress it will be accepted but not be deployed.

After that, you can use the guide you were using to deploy a secondary HTTP Load Balancer (with the same external IP address) in order to route your requests for HTTPS.



Related Topics



Leave a reply



Submit