Skip to content

Commit

Permalink
lighttpd: merge redirect conditions
Browse files Browse the repository at this point in the history
merge redirect conditions for HSTS rather than using independent
conditions

Adjust condition indenting for consistency
  • Loading branch information
gstrauss committed Sep 18, 2022
1 parent e359b04 commit a0208aa
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/templates/partials/lighttpd.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@
$SERVER["socket"] == "[::]:80" { }

{{#if form.hsts}}
$HTTP["scheme"] == "http" {
{{#if (minver "1.4.50" form.serverVersion)}}
url.redirect = ("" => "https://${url.authority}${url.path}${qsa}")
{{else}}
$HTTP["host"] =~ ".*" {
url.redirect = (".*" => "https://%0$0")
}
{{/if}}
}

$HTTP["scheme"] == "https" {
# HTTP Strict Transport Security ({{output.hstsMaxAge}} seconds)
setenv.add-response-header = (
"Strict-Transport-Security" => "max-age={{output.hstsMaxAge}}"
)
}
else $HTTP["scheme"] == "http" {
{{#if (minver "1.4.50" form.serverVersion)}}
url.redirect = ("" => "https://${url.authority}${url.path}${qsa}")
{{else}}
$HTTP["host"] =~ ".*" {
url.redirect = (".*" => "https://%0$0")
}
{{/if}}
}
{{/if}}

{{#if (minver "1.4.56" form.serverVersion)}}
Expand Down

0 comments on commit a0208aa

Please sign in to comment.