mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
httpcaddyfile: Fix ordering of catch-all site blocks
Catch-alls should always go last. Normally this is the case, but we have a special case for comparing one wildcard-host site block to another non-wildcard host site block; and a catch-all site block is also a non-wildcard host site block, so now we have to special-case the catch-all site block. Sigh. This could be reproduced with a Caddyfile that has two site blocks: ":80" and "*.example.com", in that order.
This commit is contained in:
parent
003403ecbc
commit
32cafbb630
1 changed files with 5 additions and 0 deletions
|
@ -400,6 +400,11 @@ func (st *ServerType) serversFromPairings(
|
|||
jLongestPath = addr.Path
|
||||
}
|
||||
}
|
||||
if specificity(jLongestHost) == 0 {
|
||||
// catch-all blocks (blocks with no hostname) should always go
|
||||
// last, even after blocks with wildcard hosts
|
||||
return true
|
||||
}
|
||||
if iWildcardHost != jWildcardHost {
|
||||
// site blocks that have a key with a wildcard in the hostname
|
||||
// must always be less specific than blocks without one; see
|
||||
|
|
Loading…
Reference in a new issue