fix missing Strict-Transport-Policy header, fix X-Forwarded-Prefix with regex URLs and print logs when UI tests failed

This commit is contained in:
florian 2023-08-02 16:54:05 +02:00
parent 26f2852e54
commit bf9cd367d0
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
4 changed files with 10 additions and 4 deletions

View File

@ -171,6 +171,7 @@ helpers.fill_ctx = function()
data.http_content_length = ngx.var.http_content_length
data.http_origin = ngx.var.http_origin
data.http_version = ngx.req.http_version()
data.scheme = ngx.var.scheme
end
-- IP data : global
local ip_is_global, err = utils.ip_is_global(data.remote_addr)

View File

@ -71,9 +71,7 @@ end
function headers:header()
-- Override upstream headers if needed
local ssl = self.variables["AUTO_LETS_ENCRYPT"] == "yes" or
self.variables["USE_CUSTOM_SSL"] == "yes" or
self.variables["GENERATE_SELF_SIGNED_SSL"] == "yes"
local ssl = self.ctx.bw.scheme == "https"
for variable, header in pairs(self.all_headers) do
if ngx.header[header] == nil or (self.variables[variable] ~= "" and self.variables["KEEP_UPSTREAM_HEADERS"] ~= "*" and utils.regex_match(self.variables["KEEP_UPSTREAM_HEADERS"], "(^| )" .. header .. "($| )") == nil) then
if (header ~= "Strict-Transport-Security" or ssl) then

View File

@ -48,7 +48,9 @@ location {{ url }} {% raw %}{{% endraw +%}
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
{% if url.startswith("/") +%}
proxy_set_header X-Forwarded-Prefix "{{ url }}";
{% endif %}
{% if buffering == "yes" +%}
proxy_buffering on;
{% else +%}

View File

@ -50,6 +50,11 @@ if [ $? -ne 0 ] ; then
exit 1
fi
docker-compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from ui-tests
ret=$?
if [ $ret -ne 0 ] ; then
docker-compose -f docker-compose.test.yml logs
echo "❌ Up failed"
fi
# Exit
exit $?
exit $ret