Skip to content

Commit

Permalink
chore: Update SSL check in errors.lua and headers.lua
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheophileDiot committed Jun 28, 2024
1 parent 9279527 commit 8595eb4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/common/core/errors/errors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/common/core/headers/headers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8595eb4

Please sign in to comment.