Skip to content

Commit

Permalink
Change condition order that produces endless loop
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Apr 2, 2020
1 parent b33c9a2 commit 2e16508
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rootfs/etc/nginx/lua/lua_ingress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ local function redirect_to_https(location_config)
return false
end

if ngx.var.pass_access_scheme ~= "http" then
return false
if location_config.force_ssl_redirect and ngx.var.pass_access_scheme == "http" then
return true
end

if location_config.force_ssl_redirect then
return true
if ngx.var.pass_access_scheme ~= "http" then
return false
end

return location_config.ssl_redirect and certificate_configured_for_current_request()
Expand Down Expand Up @@ -105,6 +105,7 @@ end
-- phases or redirection
function _M.rewrite(location_config)
ngx.var.pass_access_scheme = ngx.var.scheme

ngx.var.best_http_host = ngx.var.http_host or ngx.var.host

if config.use_forwarded_headers then
Expand Down

0 comments on commit 2e16508

Please sign in to comment.