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 | :8080 |
| 2 | |
| 3 | # With explicit wildcard matcher |
| 4 | route { |
| 5 | rewrite * /a |
| 6 | } |
| 7 | |
| 8 | # With path matcher |
| 9 | route { |
| 10 | rewrite /path /b |
| 11 | } |
| 12 | |
| 13 | # With named matcher |
| 14 | route { |
| 15 | @named method GET |
| 16 | rewrite @named /c |
| 17 | } |
| 18 | |
| 19 | # With no matcher, assumed to be wildcard |
| 20 | route { |
| 21 | rewrite /d |
| 22 | } |
| 23 | ---------- |
| 24 | { |
| 25 | "apps": { |
| 26 | "http": { |
| 27 | "servers": { |
| 28 | "srv0": { |
| 29 | "listen": [ |
| 30 | ":8080" |
| 31 | ], |
| 32 | "routes": [ |
| 33 | { |
| 34 | "handle": [ |
| 35 | { |
| 36 | "handler": "subroute", |
| 37 | "routes": [ |
| 38 | { |
| 39 | "group": "group0", |
| 40 | "handle": [ |
| 41 | { |
| 42 | "handler": "rewrite", |
| 43 | "uri": "/a" |
| 44 | } |
| 45 | ] |
| 46 | } |
| 47 | ] |
| 48 | }, |
| 49 | { |
| 50 | "handler": "subroute", |
| 51 | "routes": [ |
| 52 | { |
| 53 | "group": "group1", |
| 54 | "handle": [ |
| 55 | { |
| 56 | "handler": "rewrite", |
| 57 | "uri": "/b" |
| 58 | } |
| 59 | ], |
| 60 | "match": [ |
| 61 | { |
| 62 | "path": [ |
| 63 | "/path" |
| 64 | ] |
| 65 | } |
| 66 | ] |
| 67 | } |
| 68 | ] |
| 69 | }, |
| 70 | { |
| 71 | "handler": "subroute", |
| 72 | "routes": [ |
| 73 | { |
| 74 | "group": "group2", |
| 75 | "handle": [ |
| 76 | { |
| 77 | "handler": "rewrite", |
| 78 | "uri": "/c" |
| 79 | } |
| 80 | ], |
| 81 | "match": [ |
| 82 | { |
| 83 | "method": [ |
| 84 | "GET" |
| 85 | ] |
| 86 | } |
| 87 | ] |
| 88 | } |
| 89 | ] |
| 90 | }, |
| 91 | { |
| 92 | "handler": "subroute", |
| 93 | "routes": [ |
| 94 | { |
| 95 | "group": "group3", |
| 96 | "handle": [ |
| 97 | { |
| 98 | "handler": "rewrite", |
| 99 | "uri": "/d" |
| 100 | } |
| 101 | ] |
| 102 | } |
| 103 | ] |
| 104 | } |
| 105 | ] |
| 106 | } |
| 107 | ] |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | } |