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.
This commit is contained in:
Théophile Diot 2024-06-28 11:15:42 +01:00
parent 9279527acb
commit 8595eb4150
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 2 additions and 2 deletions

View file

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

View file

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