Change condition order that produces endless loop
This commit is contained in:
parent
5390ce4879
commit
8527f774f7
1 changed files with 5 additions and 4 deletions
|
@ -61,12 +61,12 @@ local function redirect_to_https(location_config)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if ngx.var.pass_access_scheme ~= "http" then
|
if location_config.force_ssl_redirect and ngx.var.pass_access_scheme == "http" then
|
||||||
return false
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if location_config.force_ssl_redirect then
|
if ngx.var.pass_access_scheme ~= "http" then
|
||||||
return true
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return location_config.ssl_redirect and certificate_configured_for_current_request()
|
return location_config.ssl_redirect and certificate_configured_for_current_request()
|
||||||
|
@ -105,6 +105,7 @@ end
|
||||||
-- phases or redirection
|
-- phases or redirection
|
||||||
function _M.rewrite(location_config)
|
function _M.rewrite(location_config)
|
||||||
ngx.var.pass_access_scheme = ngx.var.scheme
|
ngx.var.pass_access_scheme = ngx.var.scheme
|
||||||
|
|
||||||
ngx.var.best_http_host = ngx.var.http_host or ngx.var.host
|
ngx.var.best_http_host = ngx.var.http_host or ngx.var.host
|
||||||
|
|
||||||
if config.use_forwarded_headers then
|
if config.use_forwarded_headers then
|
||||||
|
|
Loading…
Reference in a new issue