summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-02-01 11:45:28 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2021-02-01 11:45:28 -0700
commit55e49ff5c88170b8978cb322dfea3688fb6d3b97 (patch)
treeb4a2ee4436a8ed6cc7b4ba0ec7e714db6b89a656
parente2940c8c03818f1227aa2c103e05fb5664635e11 (diff)
httpcaddyfile: Sort catch-all site blocks properly (fix #4003)
-rw-r--r--caddyconfig/httpcaddyfile/httptype.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index c6225df..2e7dd7c 100644
--- a/caddyconfig/httpcaddyfile/httptype.go
+++ b/caddyconfig/httpcaddyfile/httptype.go
@@ -430,9 +430,12 @@ func (st *ServerType) serversFromPairings(
jLongestPath = addr.Path
}
}
+ // catch-all blocks (blocks with no hostname) should always go
+ // last, even after blocks with wildcard hosts
+ if specificity(iLongestHost) == 0 {
+ return false
+ }
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 {