GKE Ingress redirect http to https

JeEt
1 min readApr 7, 2022
Photo by Remy_Loz on Unsplash

Generally when you create an Ingress and configure ssl/tls your domain only works for https://<your-domain.com>
This is an issue when it comes to production. Because generally the end users won’t add“https://” during web-surfing. Which will end up getting errors.

Well recently GCP came up with a solution, which is a great solution if you want your domain to redirect http → to https automatically.

This is a two step process.
Step: 1

Replace RESPONSE_CODE with one of the following:

  • MOVED_PERMANENTLY_DEFAULT to return a 301 redirect response code (default if responseCodeName is unspecified).
  • FOUND to return a 302 redirect response code.
  • SEE_OTHER to return a 303 redirect response code.
  • TEMPORARY_REDIRECT to return a 307 redirect response code.
  • PERMANENT_REDIRECT to return a 308 redirect response code.

Step: 2

Associate the Frontend-config with your ingress, with an annotation, like this

Keep an eye on the version, v1beta1At some time later, this beta version will be available over GA.

Try to verify this using, this should give or return 301 or the response you configure.

curl http://IP_ADDRESS 
or
curl http://<yourdomain.com>

--

--

JeEt

A tech enthusiast, working on Cloud and Devops past 3 years now. Love Cycling, Psychology..Botany and God knows what.