Skip to content

Instantly share code, notes, and snippets.

@psucodervn
Created November 26, 2019 02:36
Show Gist options
  • Save psucodervn/a00ada740f4d4d28cabc4c1f31ec36ce to your computer and use it in GitHub Desktop.
Save psucodervn/a00ada740f4d4d28cabc4c1f31ec36ce to your computer and use it in GitHub Desktop.
Kong auto ssl redirect
local scheme = kong.request.get_scheme()
if scheme == "http" then
local host = kong.request.get_host()
local query = kong.request.get_path_with_query()
local url = "https://" .. host ..query
kong.response.set_header("Location",url)
return kong.response.exit(302,url)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment