summaryrefslogtreecommitdiff
path: root/caddytest/integration/caddyfile_adapt
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-09-11 16:12:21 -0400
committerGitHub <noreply@github.com>2021-09-11 14:12:21 -0600
commita779e1b38390205e8286a0578042646d858039a5 (patch)
treeb80c9bd5d4e2bd278553f1fd5ab2f669ec97152e /caddytest/integration/caddyfile_adapt
parent46ab93be51754ac16bd7c59443e90481acf83022 (diff)
fastcgi: Fix Caddyfile parsing when `handle_response` is used (#4342)
Diffstat (limited to 'caddytest/integration/caddyfile_adapt')
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt145
1 files changed, 145 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt b/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt
new file mode 100644
index 0000000..42fb655
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_handle_response.txt
@@ -0,0 +1,145 @@
+:8881 {
+ php_fastcgi app:9000 {
+ env FOO bar
+
+ @error status 4xx
+ handle_response @error {
+ root * /errors
+ rewrite * /{http.reverse_proxy.status_code}.html
+ file_server
+ }
+ }
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":8881"
+ ],
+ "routes": [
+ {
+ "match": [
+ {
+ "file": {
+ "try_files": [
+ "{http.request.uri.path}/index.php"
+ ]
+ },
+ "not": [
+ {
+ "path": [
+ "*/"
+ ]
+ }
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "handler": "static_response",
+ "headers": {
+ "Location": [
+ "{http.request.uri.path}/"
+ ]
+ },
+ "status_code": 308
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "file": {
+ "try_files": [
+ "{http.request.uri.path}",
+ "{http.request.uri.path}/index.php",
+ "index.php"
+ ],
+ "split_path": [
+ ".php"
+ ]
+ }
+ }
+ ],
+ "handle": [
+ {
+ "handler": "rewrite",
+ "uri": "{http.matchers.file.relative}"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "path": [
+ "*.php"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "handle_response": [
+ {
+ "match": {
+ "status_code": [
+ 4
+ ]
+ },
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "vars",
+ "root": "/errors"
+ }
+ ]
+ },
+ {
+ "group": "group0",
+ "handle": [
+ {
+ "handler": "rewrite",
+ "uri": "/{http.reverse_proxy.status_code}.html"
+ }
+ ]
+ },
+ {
+ "handle": [
+ {
+ "handler": "file_server",
+ "hide": [
+ "./Caddyfile"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "handler": "reverse_proxy",
+ "transport": {
+ "env": {
+ "FOO": "bar"
+ },
+ "protocol": "fastcgi",
+ "split_path": [
+ ".php"
+ ]
+ },
+ "upstreams": [
+ {
+ "dial": "app:9000"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file