-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
httpcaddyfile: Improve directive sorting logic (#3658)
* httpcaddyfile: Flip `root` directive sort order * httpcaddyfile: Sort directives with any matcher before those with none * httpcaddyfile: Generalize reverse sort directives, improve logic * httpcaddyfile: Fix "spelling" issue * httpcaddyfile: Turns out the second change precludes the first httpcaddyfile: Delete test that no longer makes sense * httpcaddyfile: Shorten logic Co-authored-by: Matt Holt <[email protected]> Co-authored-by: Matt Holt <[email protected]>
- Loading branch information
1 parent
fc65320
commit 0afbab8
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
caddytest/integration/caddyfile_adapt/sort_directives_with_any_matcher_first.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
:80 | ||
|
||
file_server | ||
|
||
@untrusted not remote_ip 10.1.1.0/24 | ||
file_server @untrusted | ||
---------- | ||
{ | ||
"apps": { | ||
"http": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":80" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"not": [ | ||
{ | ||
"remote_ip": { | ||
"ranges": [ | ||
"10.1.1.0/24" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "file_server", | ||
"hide": [ | ||
"Caddyfile" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"handle": [ | ||
{ | ||
"handler": "file_server", | ||
"hide": [ | ||
"Caddyfile" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |