add missing ctx arg in core plugins, always add X-Forwarded-Prefix header and add doc about timezone in containers

This commit is contained in:
bunkerity 2023-08-01 20:18:05 +02:00
parent d59b305f1e
commit d9394567ef
11 changed files with 24 additions and 22 deletions

View file

@ -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

View file

@ -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
- 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).

View file

@ -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",

View file

@ -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()

View file

@ -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

View file

@ -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()

View file

@ -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()

View file

@ -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 +%}

View file

@ -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()

View file

@ -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",

View file

@ -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)