Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
httpcaddyfile: Sort catch-all site blocks properly (fix #4003)
Matthew Holt committed
Feb 1, 2021 at 11:45 UTC
55e49ff5c88170b8978cb322dfea3688fb6d3b97
1 file changed
+5
-2
caddyconfig/httpcaddyfile/httptype.go
+5
-2
@@ -430,9 +430,12 @@ func (st *ServerType) serversFromPairings(
430
jLongestPath = addr.Path
431
}
432
}
433
+ // catch-all blocks (blocks with no hostname) should always go
434
+ // last, even after blocks with wildcard hosts
435
+ if specificity(iLongestHost) == 0 {
436
+ return false
437
+ }
438
if specificity(jLongestHost) == 0 {
434
- // catch-all blocks (blocks with no hostname) should always go
435
- // last, even after blocks with wildcard hosts
439
return true
440
}
441
if iWildcardHost != jWildcardHost {