diff --git a/src/bw/lua/bunkerweb/helpers.lua b/src/bw/lua/bunkerweb/helpers.lua index 7994c5e3d6..cc4d11462e 100644 --- a/src/bw/lua/bunkerweb/helpers.lua +++ b/src/bw/lua/bunkerweb/helpers.lua @@ -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) diff --git a/src/common/core/headers/headers.lua b/src/common/core/headers/headers.lua index 84df637213..1ae0d1a99f 100644 --- a/src/common/core/headers/headers.lua +++ b/src/common/core/headers/headers.lua @@ -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 diff --git a/src/common/core/reverseproxy/confs/server-http/reverse-proxy.conf b/src/common/core/reverseproxy/confs/server-http/reverse-proxy.conf index 910c8966e2..2024cac6cb 100644 --- a/src/common/core/reverseproxy/confs/server-http/reverse-proxy.conf +++ b/src/common/core/reverseproxy/confs/server-http/reverse-proxy.conf @@ -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 +%} diff --git a/tests/ui/tests.sh b/tests/ui/tests.sh index 07dd9e0d10..98099c3c5b 100755 --- a/tests/ui/tests.sh +++ b/tests/ui/tests.sh @@ -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 $? \ No newline at end of file +exit $ret \ No newline at end of file