nginx ingress always redirecting to https even with configmap and annotations set

11/29/2018

I have an ingress that is configured like such:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: connect-app
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: it.tufts.edu
    http:
      paths:
      - path: "/"
        backend:
          serviceName: connect-it
          servicePort: 80

and the nginx controller has a configmap that looks like this:

apiVersion: v1
items:
- apiVersion: v1
  data:
    ssl-redirect: "false"
  kind: ConfigMap
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"v1","data":null,"kind":"ConfigMap","metadata":{"annotations":{},"name":"nginx-config","namespace":"nginx-ingress"}}
    creationTimestamp: 2018-11-13T20:56:49Z
    name: nginx-config
    namespace: nginx-ingress
    resourceVersion: "3633400"
    selfLink: /api/v1/namespaces/nginx-ingress/configmaps/nginx-config
    uid: a3ec70bc-e786-11e8-be24-005056a401f6
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

According to the documentation, this should disable the redirect from http to https but it doesn't seem to workout, what am I doing wrong?

Thanks

-- sgarre02
kubernetes
nginx-ingress

1 Answer

11/30/2018

I believe this is either:

  • A problem with your nginx ingress controller not updating the configs which you can check with:

    $ kubectl cp <nginx-ingress-controller-pod>:nginx.conf .
    $ cat nginx.conf
  • A problem with your apache config redirecting to HTTPS from HTTP (port 80)

-- Rico
Source: StackOverflow