Redirect to HTTPS using KONG API


I’m trying to redirect all HTTP to HTTPS in Kong.
I’ve set my route to only accept HTTPS and all HTTP requests are answered with a request to upgrade to HTTPS.

Is it possible to automatically redirect to HTTPS rather than telling the user to upgrade to HTTPS?

Please use https_redirect_status_code property of Route.
You can set it to 301 or 302 to automatically redirect to HTTPS.

This property was introduced in Kong 1.2, so please ensure you are using 1.2 or a later version.

1 Like

I am using kong/1.2.1 and made route accept only HTTPS and updated https_redirect_status_code 302.
After that I stopped getting response.

1 Like

Thank you. That really help.

Can you please share your solution, I am still facing the issue …

Solution was explain by user hbagdi.

Use Kong 1.2 and when setting routes for the service, add https_redirect_code=301

  • = f3f4b773-3133-424e-8608-c4f21c553c3f
  • paths[] = “/api/v1/meta”
  • protocols=https
  • https_redirect_code=301

I tried that solution but did not work for me …
Raised another request for me - HTTPS service gives 308 Permanent Redirect