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 | *.example.com { |
| 2 | tls foo@example.com { |
| 3 | dns mock |
| 4 | } |
| 5 | |
| 6 | @foo host foo.example.com |
| 7 | handle @foo { |
| 8 | respond "Foo!" |
| 9 | } |
| 10 | |
| 11 | @bar host bar.example.com |
| 12 | handle @bar { |
| 13 | respond "Bar!" |
| 14 | } |
| 15 | |
| 16 | # Fallback for otherwise unhandled domains |
| 17 | handle { |
| 18 | abort |
| 19 | } |
| 20 | } |
| 21 | ---------- |
| 22 | { |
| 23 | "apps": { |
| 24 | "http": { |
| 25 | "servers": { |
| 26 | "srv0": { |
| 27 | "listen": [ |
| 28 | ":443" |
| 29 | ], |
| 30 | "routes": [ |
| 31 | { |
| 32 | "match": [ |
| 33 | { |
| 34 | "host": [ |
| 35 | "*.example.com" |
| 36 | ] |
| 37 | } |
| 38 | ], |
| 39 | "handle": [ |
| 40 | { |
| 41 | "handler": "subroute", |
| 42 | "routes": [ |
| 43 | { |
| 44 | "group": "group3", |
| 45 | "handle": [ |
| 46 | { |
| 47 | "handler": "subroute", |
| 48 | "routes": [ |
| 49 | { |
| 50 | "handle": [ |
| 51 | { |
| 52 | "body": "Foo!", |
| 53 | "handler": "static_response" |
| 54 | } |
| 55 | ] |
| 56 | } |
| 57 | ] |
| 58 | } |
| 59 | ], |
| 60 | "match": [ |
| 61 | { |
| 62 | "host": [ |
| 63 | "foo.example.com" |
| 64 | ] |
| 65 | } |
| 66 | ] |
| 67 | }, |
| 68 | { |
| 69 | "group": "group3", |
| 70 | "handle": [ |
| 71 | { |
| 72 | "handler": "subroute", |
| 73 | "routes": [ |
| 74 | { |
| 75 | "handle": [ |
| 76 | { |
| 77 | "body": "Bar!", |
| 78 | "handler": "static_response" |
| 79 | } |
| 80 | ] |
| 81 | } |
| 82 | ] |
| 83 | } |
| 84 | ], |
| 85 | "match": [ |
| 86 | { |
| 87 | "host": [ |
| 88 | "bar.example.com" |
| 89 | ] |
| 90 | } |
| 91 | ] |
| 92 | }, |
| 93 | { |
| 94 | "group": "group3", |
| 95 | "handle": [ |
| 96 | { |
| 97 | "handler": "subroute", |
| 98 | "routes": [ |
| 99 | { |
| 100 | "handle": [ |
| 101 | { |
| 102 | "abort": true, |
| 103 | "handler": "static_response" |
| 104 | } |
| 105 | ] |
| 106 | } |
| 107 | ] |
| 108 | } |
| 109 | ] |
| 110 | } |
| 111 | ] |
| 112 | } |
| 113 | ], |
| 114 | "terminal": true |
| 115 | } |
| 116 | ] |
| 117 | } |
| 118 | } |
| 119 | }, |
| 120 | "tls": { |
| 121 | "automation": { |
| 122 | "policies": [ |
| 123 | { |
| 124 | "subjects": [ |
| 125 | "*.example.com" |
| 126 | ], |
| 127 | "issuers": [ |
| 128 | { |
| 129 | "challenges": { |
| 130 | "dns": { |
| 131 | "provider": { |
| 132 | "name": "mock" |
| 133 | } |
| 134 | } |
| 135 | }, |
| 136 | "email": "foo@example.com", |
| 137 | "module": "acme" |
| 138 | }, |
| 139 | { |
| 140 | "ca": "https://acme.zerossl.com/v2/DV90", |
| 141 | "challenges": { |
| 142 | "dns": { |
| 143 | "provider": { |
| 144 | "name": "mock" |
| 145 | } |
| 146 | } |
| 147 | }, |
| 148 | "email": "foo@example.com", |
| 149 | "module": "acme" |
| 150 | } |
| 151 | ] |
| 152 | } |
| 153 | ] |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |