| 1 |
:8881 { |
| 2 |
php_fastcgi app:9000 { |
| 3 |
env FOO bar |
| 4 |
|
| 5 |
@error status 4xx |
| 6 |
handle_response @error { |
| 7 |
root * /errors |
| 8 |
rewrite * /{http.reverse_proxy.status_code}.html |
| 9 |
file_server |
| 10 |
} |
| 11 |
} |
| 12 |
} |
| 13 |
---------- |
| 14 |
{ |
| 15 |
"apps": { |
| 16 |
"http": { |
| 17 |
"servers": { |
| 18 |
"srv0": { |
| 19 |
"listen": [ |
| 20 |
":8881" |
| 21 |
], |
| 22 |
"routes": [ |
| 23 |
{ |
| 24 |
"match": [ |
| 25 |
{ |
| 26 |
"file": { |
| 27 |
"try_files": [ |
| 28 |
"{http.request.uri.path}/index.php" |
| 29 |
] |
| 30 |
}, |
| 31 |
"not": [ |
| 32 |
{ |
| 33 |
"path": [ |
| 34 |
"*/" |
| 35 |
] |
| 36 |
} |
| 37 |
] |
| 38 |
} |
| 39 |
], |
| 40 |
"handle": [ |
| 41 |
{ |
| 42 |
"handler": "static_response", |
| 43 |
"headers": { |
| 44 |
"Location": [ |
| 45 |
"{http.request.orig_uri.path}/{http.request.orig_uri.prefixed_query}" |
| 46 |
] |
| 47 |
}, |
| 48 |
"status_code": 308 |
| 49 |
} |
| 50 |
] |
| 51 |
}, |
| 52 |
{ |
| 53 |
"match": [ |
| 54 |
{ |
| 55 |
"file": { |
| 56 |
"try_files": [ |
| 57 |
"{http.request.uri.path}", |
| 58 |
"{http.request.uri.path}/index.php", |
| 59 |
"index.php" |
| 60 |
], |
| 61 |
"try_policy": "first_exist_fallback", |
| 62 |
"split_path": [ |
| 63 |
".php" |
| 64 |
] |
| 65 |
} |
| 66 |
} |
| 67 |
], |
| 68 |
"handle": [ |
| 69 |
{ |
| 70 |
"handler": "rewrite", |
| 71 |
"uri": "{http.matchers.file.relative}" |
| 72 |
} |
| 73 |
] |
| 74 |
}, |
| 75 |
{ |
| 76 |
"match": [ |
| 77 |
{ |
| 78 |
"path": [ |
| 79 |
"*.php" |
| 80 |
] |
| 81 |
} |
| 82 |
], |
| 83 |
"handle": [ |
| 84 |
{ |
| 85 |
"handle_response": [ |
| 86 |
{ |
| 87 |
"match": { |
| 88 |
"status_code": [ |
| 89 |
4 |
| 90 |
] |
| 91 |
}, |
| 92 |
"routes": [ |
| 93 |
{ |
| 94 |
"handle": [ |
| 95 |
{ |
| 96 |
"handler": "vars", |
| 97 |
"root": "/errors" |
| 98 |
} |
| 99 |
] |
| 100 |
}, |
| 101 |
{ |
| 102 |
"group": "group0", |
| 103 |
"handle": [ |
| 104 |
{ |
| 105 |
"handler": "rewrite", |
| 106 |
"uri": "/{http.reverse_proxy.status_code}.html" |
| 107 |
} |
| 108 |
] |
| 109 |
}, |
| 110 |
{ |
| 111 |
"handle": [ |
| 112 |
{ |
| 113 |
"handler": "file_server", |
| 114 |
"hide": [ |
| 115 |
"./Caddyfile" |
| 116 |
] |
| 117 |
} |
| 118 |
] |
| 119 |
} |
| 120 |
] |
| 121 |
} |
| 122 |
], |
| 123 |
"handler": "reverse_proxy", |
| 124 |
"transport": { |
| 125 |
"env": { |
| 126 |
"FOO": "bar" |
| 127 |
}, |
| 128 |
"protocol": "fastcgi", |
| 129 |
"split_path": [ |
| 130 |
".php" |
| 131 |
] |
| 132 |
}, |
| 133 |
"upstreams": [ |
| 134 |
{ |
| 135 |
"dial": "app:9000" |
| 136 |
} |
| 137 |
] |
| 138 |
} |
| 139 |
] |
| 140 |
} |
| 141 |
] |
| 142 |
} |
| 143 |
} |
| 144 |
} |
| 145 |
} |
| 146 |
} |