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 ifresponseCodeName
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, v1beta1
At 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>