summaryrefslogtreecommitdiff
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2020-08-05 15:42:29 -0400
committerGitHub <noreply@github.com>2020-08-05 13:42:29 -0600
commit584eba94a4e06af9ce7efc91fb914f84d7a6a48c (patch)
treed01bd6c67e2bf9e8d895982a4b6f246b146b45bf /caddytest
parent904f149e5b2f0ae9eff09dacb4f1ec41c4a76298 (diff)
httpcaddyfile: Allow named matchers in `route` blocks (#3632)
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.txt132
1 files changed, 132 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.txt b/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.txt
new file mode 100644
index 0000000..d453128
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/php_fastcgi_expanded_form.txt
@@ -0,0 +1,132 @@
+:8886
+
+route {
+ # Add trailing slash for directory requests
+ @canonicalPath {
+ file {
+ try_files {path}/index.php
+ }
+ not path */
+ }
+ redir @canonicalPath {path}/ 308
+
+ # If the requested file does not exist, try index files
+ @indexFiles {
+ file {
+ try_files {path} {path}/index.php index.php
+ split_path .php
+ }
+ }
+ rewrite @indexFiles {http.matchers.file.relative}
+
+ # Proxy PHP files to the FastCGI responder
+ @phpFiles {
+ path *.php
+ }
+ reverse_proxy @phpFiles 127.0.0.1:9000 {
+ transport fastcgi {
+ split .php
+ }
+ }
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":8886"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "subroute",
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "static_response",
+ "headers": {
+ "Location": [
+ "{http.request.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": "127.0.0.1:9000"
+ }
+ ]
+ }
+ ],
+ "match": [
+ {
+ "path": [
+ "*.php"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file