From d809f2f8a0a166cbc27cbde2dddceadbd34a78e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Tue, 19 Nov 2024 14:34:23 +0100 Subject: [PATCH] fix: update get_reason function to correctly retrieve security mode from context --- src/bw/lua/bunkerweb/utils.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bw/lua/bunkerweb/utils.lua b/src/bw/lua/bunkerweb/utils.lua index f0455cb60..92780a981 100644 --- a/src/bw/lua/bunkerweb/utils.lua +++ b/src/bw/lua/bunkerweb/utils.lua @@ -288,10 +288,10 @@ end utils.get_reason = function(ctx) -- ngx.ctx - if ctx and ctx.bw and ctx.bw.reason then - return ctx.bw.reason, ctx.bw.reason_data or {}, ctx.bw.security_mode - end local security_mode = utils.get_security_mode(ctx) + if ctx and ctx.bw and ctx.bw.reason then + return ctx.bw.reason, ctx.bw.reason_data or {}, security_mode + end -- ngx.var local var_reason = var.reason if var_reason and var_reason ~= "" then @@ -575,7 +575,7 @@ utils.get_deny_status = function() end utils.get_security_mode = function(ctx) - local security_mode, err = utils.get_variable("SECURITY_MODE", true, ctx) + local security_mode, _ = utils.get_variable("SECURITY_MODE", true, ctx) if not security_mode then return "block" end