diff options
author | Francis Lavoie <lavofr@gmail.com> | 2020-08-17 18:15:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 16:15:51 -0600 |
commit | 0afbab866794448fc0fe8b6cd6a299d7a078c2f1 (patch) | |
tree | 5f91223d2579f3a96c10087ab148ca2f16b7accb /caddytest/integration | |
parent | fc65320e9c5b4e2ab96b6b421b65629560f1b8a2 (diff) |
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 <mholt@users.noreply.github.com>
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Diffstat (limited to 'caddytest/integration')
-rw-r--r-- | caddytest/integration/caddyfile_adapt/sort_directives_with_any_matcher_first.txt | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/sort_directives_with_any_matcher_first.txt b/caddytest/integration/caddyfile_adapt/sort_directives_with_any_matcher_first.txt new file mode 100644 index 0000000..d15f56b --- /dev/null +++ b/caddytest/integration/caddyfile_adapt/sort_directives_with_any_matcher_first.txt @@ -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"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+}
\ No newline at end of file |