diff --git a/CHANGELOG.md b/CHANGELOG.md index 050f8f300..e80d86658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,9 +23,12 @@ - [FEATURE] Add KEEP_UPSTREAM_HEADERS to preserve headers when using reverse proxy - [FEATURE] Add the possibility to download the different lists and plugins from a local file (like the blacklist) - [FEATURE] External plugins can now be downloaded from a tar.gz and tar.xz file as well as zip +- [FEATURE] Add X-Forwarded-Prefix header when using reverse proxy +- [DOCUMENTATION] Add timezone information to the doc - [MISC] Add LOG_LEVEL=warning for docker socket proxy in docs, examples and boilerplates - [MISC] Temp remove VMWare provider for Vagrant integration - [MISC] Remove X-Script-Name header and ABSOLUTE_URI variable when using UI +- [MISC] Move logs to /var/log/bunkerweb folder ## v1.5.0 - 2023/05/23 diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 4db257fec..578c93fd3 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -280,4 +280,8 @@ If you have bots that need to access your website, the recommended way to avoid - Healthcheck / status bot - Callback like IPN or webhook -- Social media crawler \ No newline at end of file +- Social media crawler + +## Timezone + +When using container-based integrations, the timezone of the container may not match the one of the host machine. To resolve that, you can set the `TZ` environment variable to the timezone of your choice on your containers (e.g. `TZ=Europe/Paris`). You will find the list of timezone identifers [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). \ No newline at end of file diff --git a/src/common/core/headers/headers.lua b/src/common/core/headers/headers.lua index 2574e9e29..84df63721 100644 --- a/src/common/core/headers/headers.lua +++ b/src/common/core/headers/headers.lua @@ -4,9 +4,9 @@ local utils = require "bunkerweb.utils" local headers = class("headers", plugin) -function headers:initialize() +function headers:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "headers") + plugin.initialize(self, "headers", ctx) self.all_headers = { ["STRICT_TRANSPORT_SECURITY"] = "Strict-Transport-Security", ["CONTENT_SECURITY_POLICY"] = "Content-Security-Policy", diff --git a/src/common/core/letsencrypt/letsencrypt.lua b/src/common/core/letsencrypt/letsencrypt.lua index b216ef609..8cf70af5d 100644 --- a/src/common/core/letsencrypt/letsencrypt.lua +++ b/src/common/core/letsencrypt/letsencrypt.lua @@ -4,9 +4,9 @@ local cjson = require "cjson" local letsencrypt = class("letsencrypt", plugin) -function letsencrypt:initialize() +function letsencrypt:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "letsencrypt") + plugin.initialize(self, "letsencrypt", ctx) end function letsencrypt:access() diff --git a/src/common/core/limit/limit.lua b/src/common/core/limit/limit.lua index eca68bec9..c9ccd5a1f 100644 --- a/src/common/core/limit/limit.lua +++ b/src/common/core/limit/limit.lua @@ -5,9 +5,9 @@ local cjson = require "cjson" local limit = class("limit", plugin) -function limit:initialize() +function limit:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "limit") + plugin.initialize(self, "limit", ctx) -- Load rules if needed if ngx.get_phase() ~= "init" and self:is_needed() then -- Get all rules from datastore diff --git a/src/common/core/misc/misc.lua b/src/common/core/misc/misc.lua index 1b7d5c653..9ad501185 100644 --- a/src/common/core/misc/misc.lua +++ b/src/common/core/misc/misc.lua @@ -4,9 +4,9 @@ local utils = require "bunkerweb.utils" local misc = class("misc", plugin) -function misc:initialize() +function misc:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "misc") + plugin.initialize(self, "misc", ctx) end function misc:access() diff --git a/src/common/core/redis/redis.lua b/src/common/core/redis/redis.lua index 82448accd..36e11d961 100644 --- a/src/common/core/redis/redis.lua +++ b/src/common/core/redis/redis.lua @@ -5,7 +5,7 @@ local redis = class("redis", plugin) function redis:initialize() -- Call parent initialize - plugin.initialize(self, "redis") + plugin.initialize(self, "redis", ctx) end function redis:init_worker() 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 4318bf328..910c8966e 100644 --- a/src/common/core/reverseproxy/confs/server-http/reverse-proxy.conf +++ b/src/common/core/reverseproxy/confs/server-http/reverse-proxy.conf @@ -48,12 +48,7 @@ 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 USE_UI == "yes" +%} - {% if url.endswith("/") +%} - {% set url = url[:-1] +%} - {% endif +%} - proxy_set_header X-Forwarded-Prefix {{ url }}; - {% endif +%} + proxy_set_header X-Forwarded-Prefix "{{ url }}"; {% if buffering == "yes" +%} proxy_buffering on; {% else +%} diff --git a/src/common/core/reversescan/reversescan.lua b/src/common/core/reversescan/reversescan.lua index 6dd9c559b..45ed1af63 100644 --- a/src/common/core/reversescan/reversescan.lua +++ b/src/common/core/reversescan/reversescan.lua @@ -6,9 +6,9 @@ local cjson = require "cjson" local reversescan = class("reversescan", plugin) -function reversescan:initialize() +function reversescan:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "reversescan") + plugin.initialize(self, "reversescan", ctx) end function reversescan:access() diff --git a/src/common/core/sessions/sessions.lua b/src/common/core/sessions/sessions.lua index 1db9b8ced..117763a86 100644 --- a/src/common/core/sessions/sessions.lua +++ b/src/common/core/sessions/sessions.lua @@ -5,9 +5,9 @@ local session = require "resty.session" local sessions = class("sessions", plugin) -function sessions:initialize() +function sessions:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "sessions") + plugin.initialize(self, "sessions", ctx) -- Check if random cookie name and secrets are already generated local is_random = { "SESSIONS_SECRET", diff --git a/src/common/core/whitelist/whitelist.lua b/src/common/core/whitelist/whitelist.lua index 519f2a1a8..8b105e996 100644 --- a/src/common/core/whitelist/whitelist.lua +++ b/src/common/core/whitelist/whitelist.lua @@ -6,9 +6,9 @@ local env = require "resty.env" local whitelist = class("whitelist", plugin) -function whitelist:initialize() +function whitelist:initialize(ctx) -- Call parent initialize - plugin.initialize(self, "whitelist") + plugin.initialize(self, "whitelist", ctx) -- Decode lists if ngx.get_phase() ~= "init" and self:is_needed() then local lists, err = self.datastore:get("plugin_whitelist_lists", true)