Deepak Garg
Deepak Garg

Reputation: 356

SSL redirection with Google Ingress and Managed certificate

Is it possible to configure SSL redirection (forcing https over http) with Google Ingress and Managed certificates in GKE ? If yes, then how ? This documentation doesn't mention it: https://cloud.google.com/kubernetes-engine/docs/how-to/managed-certs

Upvotes: 0

Views: 373

Answers (2)

Nikhil
Nikhil

Reputation: 1018

Under annotation section of GKE Ingress yaml, try using force-ssl-redirect

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: gke-ingress-test
  annotations:
    ingress.kubernetes.io/ingress.static-ip: gke-ingress-test-stat-ip
    networking.gke.io/managed-certificates: "domain1,domain2"
    ingress.gcp.kubernetes.io/pre-shared-cert: "domain3,domain4"
    ingress.kubernetes.io/force-ssl-redirect: "true" 
spec:
  rules:

Upvotes: 0

yyyyahir
yyyyahir

Reputation: 2322

For now there is no way to force redirection to the SSL version of sites when using the GCE ingress class. However, there are feature requests to make this possible in the future.

If you need this feature you can either, do the automatic redirection directly in the backend rather than the ingress or, you can use another ingress class, such as Nginx, with support for this feature.

Alternatively, you can disallow HTTP using an ingress annotation, leaving only HTTPS available.

Upvotes: 2

Related Questions