Replies: 1 comment 1 reply
-
if anyone else stumbles across this i was able to accomplish it by setting a global plugin. there might be a more efficient function. this was just something i found. apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name: https-redirect
annotations:
kubernetes.io/ingress.class: kong
labels:
global: "true"
plugin: pre-function
config:
functions:
- |
if kong.request.get_header("X-Forwarded-Proto") == "http" then
local host = kong.request.get_host()
if host ~= "localhost" then
local query = kong.request.get_path_with_query()
local url = "https://" .. host ..query
kong.response.set_header("Location",url)
return kong.response.exit(308,url)
end
end |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've researched pretty exhaustively looking for a way to globally redirect all http traffic to https without finding a solution.
i am interested in how to accomplish this both via kong and via the ingress controller helm chart.
The nginx ingress controller has such an option https://docs.nginx.com/nginx-ingress-controller/configuration/global-configuration/configmap-resource/#auth-and-ssltls:~:text=False-,ssl%2Dredirect,-Sets%20an%20unconditional
and is configurable in their helm chart here https://artifacthub.io/packages/helm/ingress-nginx/ingress-nginx#:~:text=%5B%5D-,controller.config,-object
is there a way to set this that I am missing?
Beta Was this translation helpful? Give feedback.
All reactions