Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 01:00 UTC
| 1 | *.sandbox.localhost { |
| 2 | @sandboxPort { |
| 3 | header_regexp port Host ^([0-9]{3})\.sandbox\. |
| 4 | } |
| 5 | handle @sandboxPort { |
| 6 | reverse_proxy app:6{re.port.1} |
| 7 | } |
| 8 | handle { |
| 9 | redir {scheme}://application.localhost |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | ---------- |
| 14 | { |
| 15 | "apps": { |
| 16 | "http": { |
| 17 | "servers": { |
| 18 | "srv0": { |
| 19 | "listen": [ |
| 20 | ":443" |
| 21 | ], |
| 22 | "routes": [ |
| 23 | { |
| 24 | "match": [ |
| 25 | { |
| 26 | "host": [ |
| 27 | "*.sandbox.localhost" |
| 28 | ] |
| 29 | } |
| 30 | ], |
| 31 | "handle": [ |
| 32 | { |
| 33 | "handler": "subroute", |
| 34 | "routes": [ |
| 35 | { |
| 36 | "group": "group2", |
| 37 | "handle": [ |
| 38 | { |
| 39 | "handler": "subroute", |
| 40 | "routes": [ |
| 41 | { |
| 42 | "handle": [ |
| 43 | { |
| 44 | "handler": "reverse_proxy", |
| 45 | "upstreams": [ |
| 46 | { |
| 47 | "dial": "app:6{http.regexp.port.1}" |
| 48 | } |
| 49 | ] |
| 50 | } |
| 51 | ] |
| 52 | } |
| 53 | ] |
| 54 | } |
| 55 | ], |
| 56 | "match": [ |
| 57 | { |
| 58 | "header_regexp": { |
| 59 | "Host": { |
| 60 | "name": "port", |
| 61 | "pattern": "^([0-9]{3})\\.sandbox\\." |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | ] |
| 66 | }, |
| 67 | { |
| 68 | "group": "group2", |
| 69 | "handle": [ |
| 70 | { |
| 71 | "handler": "subroute", |
| 72 | "routes": [ |
| 73 | { |
| 74 | "handle": [ |
| 75 | { |
| 76 | "handler": "static_response", |
| 77 | "headers": { |
| 78 | "Location": [ |
| 79 | "{http.request.scheme}://application.localhost" |
| 80 | ] |
| 81 | }, |
| 82 | "status_code": 302 |
| 83 | } |
| 84 | ] |
| 85 | } |
| 86 | ] |
| 87 | } |
| 88 | ] |
| 89 | } |
| 90 | ] |
| 91 | } |
| 92 | ], |
| 93 | "terminal": true |
| 94 | } |
| 95 | ] |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |