Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpcaddyfile: Support explicitly turning off strict_sni_host #4592

Merged
merged 2 commits into from Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions caddyconfig/httpcaddyfile/serveroptions.go
Expand Up @@ -157,11 +157,14 @@ func unmarshalCaddyfileServerOptions(d *caddyfile.Dispenser) (interface{}, error
serverOpts.ExperimentalHTTP3 = true

case "strict_sni_host":
if d.NextArg() {
return nil, d.ArgErr()
if d.NextArg() && d.Val() != "insecure_off" && d.Val() != "on" {
return nil, d.Errf("strict_sni_host only supports 'on' or 'insecure_off', got '%s'", d.Val())
}
boolVal := true
if d.Val() == "insecure_off" {
boolVal = false
}
trueBool := true
serverOpts.StrictSNIHost = &trueBool
serverOpts.StrictSNIHost = &boolVal

default:
return nil, d.Errf("unrecognized protocol option '%s'", d.Val())
Expand Down
Expand Up @@ -3,6 +3,9 @@
timeouts {
idle 90s
}
protocol {
strict_sni_host insecure_off
}
}
servers :80 {
timeouts {
Expand All @@ -13,6 +16,9 @@
timeouts {
idle 30s
}
protocol {
strict_sni_host
}
}
}

Expand Down Expand Up @@ -46,7 +52,8 @@ http://bar.com {
],
"terminal": true
}
]
],
"strict_sni_host": true
},
"srv1": {
"listen": [
Expand All @@ -70,7 +77,8 @@ http://bar.com {
"listen": [
":8080"
],
"idle_timeout": 90000000000
"idle_timeout": 90000000000,
"strict_sni_host": false
}
}
}
Expand Down