From 8595eb4150ca5d1ad85411568a25621ea0bb4eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Fri, 28 Jun 2024 11:15:42 +0100 Subject: [PATCH] chore: Update SSL check in errors.lua and headers.lua This commit updates the SSL check in the `errors.lua` and `headers.lua` files to use the `scheme` property of the `bw` context object instead of the `https_configured` property. This change ensures that the SSL check is consistent across the application and follows best practices for secure communication over HTTPS. --- src/common/core/errors/errors.lua | 2 +- src/common/core/headers/headers.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/core/errors/errors.lua b/src/common/core/errors/errors.lua index 242a424ef..d46cf0b48 100644 --- a/src/common/core/errors/errors.lua +++ b/src/common/core/errors/errors.lua @@ -104,7 +104,7 @@ function errors:render_template(code) -- Override HSTS header local ssl - if self.ctx.bw and self.ctx.bw.https_configured == "yes" then + if self.ctx.bw and self.ctx.bw.scheme == "https" then ssl = true else ssl = ngx.var.scheme == "https" diff --git a/src/common/core/headers/headers.lua b/src/common/core/headers/headers.lua index d93e12e10..cae9ae603 100644 --- a/src/common/core/headers/headers.lua +++ b/src/common/core/headers/headers.lua @@ -80,7 +80,7 @@ end function headers:header() -- Override upstream headers if needed local ngx_header = ngx.header - local ssl = self.ctx.bw.https_configured == "yes" + local ssl = self.ctx.bw.scheme == "https" for variable, header in pairs(self.all_headers) do if ngx_header[header] == nil