summaryrefslogtreecommitdiff
path: root/caddytest/integration
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2022-10-12 09:27:08 -0600
committerGitHub <noreply@github.com>2022-10-12 09:27:08 -0600
commit3e1fd2a8d4d1463574033fbbdf5c27a693f9a86c (patch)
treed1d1390daf7339278bd4aedeb5bbb2ee9fba0242 /caddytest/integration
parent33f60da9f2d6edc5de550275f043c4262d23f6ca (diff)
httpcaddyfile: Wrap site block in subroute if host matcher used (#5130)
* httpcaddyfile: Wrap site block in subroute if host matcher used (fix #5124) * Correct boolean logic (oops)
Diffstat (limited to 'caddytest/integration')
-rw-r--r--caddytest/integration/caddyfile_adapt/global_server_options_multi.txt8
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.txt155
2 files changed, 87 insertions, 76 deletions
diff --git a/caddytest/integration/caddyfile_adapt/global_server_options_multi.txt b/caddytest/integration/caddyfile_adapt/global_server_options_multi.txt
index c01173b..ca5306f 100644
--- a/caddytest/integration/caddyfile_adapt/global_server_options_multi.txt
+++ b/caddytest/integration/caddyfile_adapt/global_server_options_multi.txt
@@ -3,9 +3,7 @@
timeouts {
idle 90s
}
- protocol {
- strict_sni_host insecure_off
- }
+ strict_sni_host insecure_off
}
servers :80 {
timeouts {
@@ -16,9 +14,7 @@
timeouts {
idle 30s
}
- protocol {
- strict_sni_host
- }
+ strict_sni_host
}
}
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.txt b/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.txt
index d90b2cb..e5b331e 100644
--- a/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.txt
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_matcher.txt
@@ -1,7 +1,12 @@
:8884
-@api host example.com
-php_fastcgi @api localhost:9000
+# the use of a host matcher here should cause this
+# site block to be wrapped in a subroute, even though
+# the site block does not have a hostname; this is
+# to prevent auto-HTTPS from picking up on this host
+# matcher because it is not a key on the site block
+@test host example.com
+php_fastcgi @test localhost:9000
----------
{
"apps": {
@@ -13,13 +18,6 @@ php_fastcgi @api localhost:9000
],
"routes": [
{
- "match": [
- {
- "host": [
- "example.com"
- ]
- }
- ],
"handle": [
{
"handler": "subroute",
@@ -27,82 +25,99 @@ php_fastcgi @api localhost:9000
{
"handle": [
{
- "handler": "static_response",
- "headers": {
- "Location": [
- "{http.request.orig_uri.path}/"
- ]
- },
- "status_code": 308
- }
- ],
- "match": [
- {
- "file": {
- "try_files": [
- "{http.request.uri.path}/index.php"
- ]
- },
- "not": [
+ "handler": "subroute",
+ "routes": [
{
- "path": [
- "*/"
+ "handle": [
+ {
+ "handler": "static_response",
+ "headers": {
+ "Location": [
+ "{http.request.orig_uri.path}/"
+ ]
+ },
+ "status_code": 308
+ }
+ ],
+ "match": [
+ {
+ "file": {
+ "try_files": [
+ "{http.request.uri.path}/index.php"
+ ]
+ },
+ "not": [
+ {
+ "path": [
+ "*/"
+ ]
+ }
+ ]
+ }
]
- }
- ]
- }
- ]
- },
- {
- "handle": [
- {
- "handler": "rewrite",
- "uri": "{http.matchers.file.relative}"
- }
- ],
- "match": [
- {
- "file": {
- "split_path": [
- ".php"
- ],
- "try_files": [
- "{http.request.uri.path}",
- "{http.request.uri.path}/index.php",
- "index.php"
- ]
- }
- }
- ]
- },
- {
- "handle": [
- {
- "handler": "reverse_proxy",
- "transport": {
- "protocol": "fastcgi",
- "split_path": [
- ".php"
- ]
- },
- "upstreams": [
+ },
{
- "dial": "localhost:9000"
+ "handle": [
+ {
+ "handler": "rewrite",
+ "uri": "{http.matchers.file.relative}"
+ }
+ ],
+ "match": [
+ {
+ "file": {
+ "split_path": [
+ ".php"
+ ],
+ "try_files": [
+ "{http.request.uri.path}",
+ "{http.request.uri.path}/index.php",
+ "index.php"
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "handle": [
+ {
+ "handler": "reverse_proxy",
+ "transport": {
+ "protocol": "fastcgi",
+ "split_path": [
+ ".php"
+ ]
+ },
+ "upstreams": [
+ {
+ "dial": "localhost:9000"
+ }
+ ]
+ }
+ ],
+ "match": [
+ {
+ "path": [
+ "*.php"
+ ]
+ }
+ ]
}
]
}
],
"match": [
{
- "path": [
- "*.php"
+ "host": [
+ "example.com"
]
}
]
}
]
}
- ]
+ ],
+ "terminal": true
}
]
}