HTTPS redirect not working with annotation

Greetings,

In the past I used a KongIngress to redirect HTTP to HTTPS and annotated my ingress resource with the respective KongIngress. Working perfectly

I just updated my cluster with the Kong all-in-one-dbless script to the newest version kong:2.0 and kong-ingress-controller:0.9.1.
Now I use “konghq.com/https-redirect-status-code” directly on the ingress resource. Therefore assuming that the KongIngress for redirecting HTTP traffic is not necessary anymore.

Unfortunately the annotation has no impact at all. Do I need to configure a KongIngress and annotate it with “konghq.com/override” on the ingress resource? If yes, what does the annotation “konghq.com/https-redirect-status-code” do?

Thanks and best regards

appendix ingress resource:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    konghq.com/https-redirect-status-code: "301"
    konghq.com/strip-path: "true"
    kubernetes.io/ingress.class: kong
    kubernetes.io/tls-acme: "true"
  name: frontend
  namespace: dev
spec:
  rules:
  - host: dev.xx.net
    http:
      paths:
      - backend:
          serviceName: frontend
          servicePort: 80
        path: /
  tls:
  - hosts:
    - dev.xx.net
    secretName: frontend-tls

You also need to add:
konghq.com/protocols: https
because the default is http,https meaning it will not redirect traffic on http.

1 Like

I missed that like a pro… Thanks - working perfectly now!

1 Like