Francis Lavoie
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
43 additions and
6 deletions
-
caddyconfig/httpcaddyfile/builtins.go
-
caddyconfig/httpcaddyfile/httptype.go
-
caddyconfig/httpcaddyfile/options.go
-
caddytest/integration/caddyfile_adapt/auto_https_ignore_loaded_certs.txt
|
|
@ -126,10 +126,10 @@ func parseTLS(h Helper) ([]ConfigValue, error) { |
|
|
|
// must load each cert only once; otherwise, they each get a
|
|
|
|
// different tag... since a cert loaded twice has the same
|
|
|
|
// bytes, it will overwrite the first one in the cache, and
|
|
|
|
// only the last cert (and its tag) will survive, so a any conn
|
|
|
|
// policy that is looking for any tag but the last one to be
|
|
|
|
// loaded won't find it, and TLS handshakes will fail (see end)
|
|
|
|
// of issue #3004)
|
|
|
|
// only the last cert (and its tag) will survive, so any conn
|
|
|
|
// policy that is looking for any tag other than the last one
|
|
|
|
// to be loaded won't find it, and TLS handshakes will fail
|
|
|
|
// (see end of issue #3004)
|
|
|
|
//
|
|
|
|
// tlsCertTags maps certificate filenames to their tag.
|
|
|
|
// This is used to remember which tag is used for each
|
|
|
|
|
|
@ -451,6 +451,9 @@ func (st *ServerType) serversFromPairings( |
|
|
|
if autoHTTPS == "disable_redirects" { |
|
|
|
srv.AutoHTTPS.DisableRedir = true |
|
|
|
} |
|
|
|
if autoHTTPS == "ignore_loaded_certs" { |
|
|
|
srv.AutoHTTPS.IgnoreLoadedCerts = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// sort server blocks by their keys; this is important because
|
|
|
|
|
|
@ -379,8 +379,8 @@ func parseOptAutoHTTPS(d *caddyfile.Dispenser, _ interface{}) (interface{}, erro |
|
|
|
if d.Next() { |
|
|
|
return "", d.ArgErr() |
|
|
|
} |
|
|
|
if val != "off" && val != "disable_redirects" { |
|
|
|
return "", d.Errf("auto_https must be either 'off' or 'disable_redirects'") |
|
|
|
if val != "off" && val != "disable_redirects" && val != "ignore_loaded_certs" { |
|
|
|
return "", d.Errf("auto_https must be one of 'off', 'disable_redirects' or 'ignore_loaded_certs'") |
|
|
|
} |
|
|
|
return val, nil |
|
|
|
} |
|
|
|
|
|
@ -0,0 +1,34 @@ |
|
|
|
{ |
|
|
|
auto_https ignore_loaded_certs |
|
|
|
} |
|
|
|
|
|
|
|
localhost |
|
|
|
---------- |
|
|
|
{ |
|
|
|
"apps": { |
|
|
|
"http": { |
|
|
|
"servers": { |
|
|
|
"srv0": { |
|
|
|
"listen": [ |
|
|
|
":443" |
|
|
|
], |
|
|
|
"routes": [ |
|
|
|
{ |
|
|
|
"match": [ |
|
|
|
{ |
|
|
|
"host": [ |
|
|
|
"localhost" |
|
|
|
] |
|
|
|
} |
|
|
|
], |
|
|
|
"terminal": true |
|
|
|
} |
|
|
|
], |
|
|
|
"automatic_https": { |
|
|
|
"ignore_loaded_certificates": true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |