SSL Redirect from http to https

I got stuck with the problem.

I try to configure simple SSL redirect from http to https, but I get in 302 redirect loop.

what I done:

  1. configured KongIngress:

echo "apiVersion:configuration.konghq.com/v1
kind: KongIngress
metadata:
name: https-only
route:
protocols:

  • https
    https_redirect_status_code: 302
    " | kubectl apply -f -
  1. attached it to Ingress:

kind: Ingress
metadata:
annotations:
:konghq.com/override: https-only
:kubernetes.io/ingress.class: kong
:kubernetes.io/tls-acme: ‘true’

got 302 redirect loop…

if I do the same with Nginx Ingress everything works fine:

kind: Ingress
metadata:
annotations:
:kubernetes.io/ingress.class: nginx
:kubernetes.io/tls-acme: ‘true’
:nginx.ingress.kubernetes.io/ssl-redirect: ‘true’

I suppose nginx.ingress.kubernetes.io/ssl-redirect: ‘true’ works not in the same way as https_redirect_status_code.
I use cert-manger for auto SSL generating and I have CloudFlare in front of k8s cluster, but as I wrote earlier there is no such problem with nginx ingress controller.

What can be a problem here? any workarounds?
kong:2.1
kong-ingress-controller:0.9.1

thanks in advance for any tips.

I have found solution here:

added env var:

KONG_TRUSTED_IPS=0.0.0.0/0,::/0

Hello
I assume the answer is somewhere above, but still.

Have a look at available Kong Ingress annotations at https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/references/annotations.md. The relevant annotation is konghq.com/protocols.

Br

Hans K.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ