fix duplicate hsts bug

This commit is contained in:
Elvin Efendi 2019-12-12 13:49:13 -05:00
parent 49ba53b7b6
commit 54918c0ff2
2 changed files with 3 additions and 0 deletions

View file

@ -142,7 +142,9 @@ function _M.rewrite(location_config)
ngx_redirect(uri, config.http_redirect_code)
end
end
function _M.header()
if config.hsts and ngx.var.scheme == "https" and certificate_configured_for_current_request then
local value = "max-age=" .. config.hsts_max_age
if config.hsts_include_subdomains then

View file

@ -991,6 +991,7 @@ stream {
#}
header_filter_by_lua_block {
lua_ingress.header()
plugins.run()
}