# SSL Redirect from http to https

**URL:** <https://discuss.konghq.com/t/ssl-redirect-from-http-to-https/7012>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [August 31, 2020, 5:22pm UTC](https://discuss.konghq.com/t/ssl-redirect-from-http-to-https/7012 "2020-08-31T17:22:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitriy\_Khodakovskyi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/dmitriy_khodakovskyi/32/2187_2.png) [@Dmitriy\_Khodakovskyi](https://discuss.konghq.com/u/Dmitriy_Khodakovskyi)\
**Post date:** [August 31, 2020, 5:22pm UTC](https://discuss.konghq.com/t/ssl-redirect-from-http-to-https/7012/1 "2020-08-31T17:22:21Z")

</div>

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:](http://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.

---

<div class="post-metadata">

**Author:** ![Dmitriy\_Khodakovskyi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/dmitriy_khodakovskyi/32/2187_2.png) [@Dmitriy\_Khodakovskyi](https://discuss.konghq.com/u/Dmitriy_Khodakovskyi)\
**Post date:** [August 31, 2020, 8:40pm UTC](https://discuss.konghq.com/t/ssl-redirect-from-http-to-https/7012/2 "2020-08-31T20:40:49Z")

</div>

I have found solution here:

> [@HTTP to HTTPS redirect with kong-ingress and TLS-offloading](https://discuss.konghq.com/t/http-to-https-redirect-with-kong-ingress-and-tls-offloading/4783/3):
>
> Hi @hbagdi @thecodingrobot I have the same issue. Were you able to resolve it? Ingress and KongIngress definitions: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: "2048-ingress" namespace: "2048-game" annotations: kubernetes.io/ingress.class: kong kubernetes.io/tls-acme: "true" configuration.konghq.com: https-only labels: app: 2048-ingress spec: rules: - host: 2048.test.com http: paths: - path: / backend: …

added env var:

> KONG\_TRUSTED\_IPS=0.0.0.0/0,::/0

---

<div class="post-metadata">

**Author:** ![Hans\_Kristian\_Norden](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hans_kristian_norden/32/1944_2.png) [@Hans\_Kristian\_Norden](https://discuss.konghq.com/u/Hans_Kristian_Norden)\
**Post date:** [September 9, 2020, 7:10pm UTC](https://discuss.konghq.com/t/ssl-redirect-from-http-to-https/7012/3 "2020-09-09T19:10:00Z")

</div>

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](https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/references/annotations.md). The relevant annotation is `konghq.com/protocols`.

Br

Hans K.
