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 | :8884 { |
| 2 | map {host} {upstream} { |
| 3 | foo.example.com 1.2.3.4 |
| 4 | default 2.3.4.5 |
| 5 | } |
| 6 | |
| 7 | # Upstream placeholder with a port should retain the port |
| 8 | reverse_proxy {upstream}:80 |
| 9 | } |
| 10 | |
| 11 | :8885 { |
| 12 | map {host} {upstream} { |
| 13 | foo.example.com 1.2.3.4:8080 |
| 14 | default 2.3.4.5:8080 |
| 15 | } |
| 16 | |
| 17 | # Upstream placeholder with no port should not have a port joined |
| 18 | reverse_proxy {upstream} |
| 19 | } |
| 20 | ---------- |
| 21 | { |
| 22 | "apps": { |
| 23 | "http": { |
| 24 | "servers": { |
| 25 | "srv0": { |
| 26 | "listen": [ |
| 27 | ":8884" |
| 28 | ], |
| 29 | "routes": [ |
| 30 | { |
| 31 | "handle": [ |
| 32 | { |
| 33 | "defaults": [ |
| 34 | "2.3.4.5" |
| 35 | ], |
| 36 | "destinations": [ |
| 37 | "{upstream}" |
| 38 | ], |
| 39 | "handler": "map", |
| 40 | "mappings": [ |
| 41 | { |
| 42 | "input": "foo.example.com", |
| 43 | "outputs": [ |
| 44 | "1.2.3.4" |
| 45 | ] |
| 46 | } |
| 47 | ], |
| 48 | "source": "{http.request.host}" |
| 49 | }, |
| 50 | { |
| 51 | "handler": "reverse_proxy", |
| 52 | "upstreams": [ |
| 53 | { |
| 54 | "dial": "{upstream}:80" |
| 55 | } |
| 56 | ] |
| 57 | } |
| 58 | ] |
| 59 | } |
| 60 | ] |
| 61 | }, |
| 62 | "srv1": { |
| 63 | "listen": [ |
| 64 | ":8885" |
| 65 | ], |
| 66 | "routes": [ |
| 67 | { |
| 68 | "handle": [ |
| 69 | { |
| 70 | "defaults": [ |
| 71 | "2.3.4.5:8080" |
| 72 | ], |
| 73 | "destinations": [ |
| 74 | "{upstream}" |
| 75 | ], |
| 76 | "handler": "map", |
| 77 | "mappings": [ |
| 78 | { |
| 79 | "input": "foo.example.com", |
| 80 | "outputs": [ |
| 81 | "1.2.3.4:8080" |
| 82 | ] |
| 83 | } |
| 84 | ], |
| 85 | "source": "{http.request.host}" |
| 86 | }, |
| 87 | { |
| 88 | "handler": "reverse_proxy", |
| 89 | "upstreams": [ |
| 90 | { |
| 91 | "dial": "{upstream}" |
| 92 | } |
| 93 | ] |
| 94 | } |
| 95 | ] |
| 96 | } |
| 97 | ] |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |