Disable SSL redirect for Kubernetes NGINX ingress

4/29/2018

An SSL redirect is enabled by default in a Kubernetes NGINX ingress. How can this be disabled? Current implementation below:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: project_name-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: project_name
          servicePort: 80
-- willsquire
kubernetes
nginx

1 Answer

4/29/2018

Adding ingress.kubernetes.io/ssl-redirect: "false" to annotations will disable the SSL redirect:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: project_name-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: project_name
          servicePort: 80

Note that false is wrapped in quotation marks. I found it didn't work without this string casting.

-- willsquire
Source: StackOverflow