mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-28 06:33:47 +03:00
host matcher: Strip [ ] from IPv6 addresses
This commit is contained in:
parent
4c289fc6ad
commit
bc9f944837
2 changed files with 5 additions and 1 deletions
|
@ -268,7 +268,7 @@ func (st *ServerType) serversFromPairings(
|
||||||
}
|
}
|
||||||
if _, ok := sblock.pile["tls.off"]; ok {
|
if _, ok := sblock.pile["tls.off"]; ok {
|
||||||
// tls off: disable TLS (and automatic HTTPS) for server block's names
|
// tls off: disable TLS (and automatic HTTPS) for server block's names
|
||||||
if srv.AutoHTTPS == nil {
|
if srv.AutoHTTPS == nil && len(autoHTTPSQualifiedHosts) > 0 {
|
||||||
srv.AutoHTTPS = new(caddyhttp.AutoHTTPSConfig)
|
srv.AutoHTTPS = new(caddyhttp.AutoHTTPSConfig)
|
||||||
}
|
}
|
||||||
srv.AutoHTTPS.Skip = append(srv.AutoHTTPS.Skip, autoHTTPSQualifiedHosts...)
|
srv.AutoHTTPS.Skip = append(srv.AutoHTTPS.Skip, autoHTTPSQualifiedHosts...)
|
||||||
|
|
|
@ -112,6 +112,10 @@ func (m MatchHost) Match(r *http.Request) bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// OK; probably didn't have a port
|
// OK; probably didn't have a port
|
||||||
reqHost = r.Host
|
reqHost = r.Host
|
||||||
|
|
||||||
|
// make sure we strip the brackets from IPv6 addresses
|
||||||
|
reqHost = strings.TrimPrefix(reqHost, "[")
|
||||||
|
reqHost = strings.TrimSuffix(reqHost, "]")
|
||||||
}
|
}
|
||||||
|
|
||||||
outer:
|
outer:
|
||||||
|
|
Loading…
Reference in a new issue