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 | automated1.example.com { |
| 2 | tls force_automate |
| 3 | respond "Automated!" |
| 4 | } |
| 5 | |
| 6 | automated2.example.com { |
| 7 | tls force_automate |
| 8 | respond "Automated!" |
| 9 | } |
| 10 | |
| 11 | shadowed.example.com { |
| 12 | respond "Shadowed!" |
| 13 | } |
| 14 | |
| 15 | *.example.com { |
| 16 | tls cert.pem key.pem |
| 17 | respond "Wildcard!" |
| 18 | } |
| 19 | ---------- |
| 20 | { |
| 21 | "apps": { |
| 22 | "http": { |
| 23 | "servers": { |
| 24 | "srv0": { |
| 25 | "listen": [ |
| 26 | ":443" |
| 27 | ], |
| 28 | "routes": [ |
| 29 | { |
| 30 | "match": [ |
| 31 | { |
| 32 | "host": [ |
| 33 | "automated1.example.com" |
| 34 | ] |
| 35 | } |
| 36 | ], |
| 37 | "handle": [ |
| 38 | { |
| 39 | "handler": "subroute", |
| 40 | "routes": [ |
| 41 | { |
| 42 | "handle": [ |
| 43 | { |
| 44 | "body": "Automated!", |
| 45 | "handler": "static_response" |
| 46 | } |
| 47 | ] |
| 48 | } |
| 49 | ] |
| 50 | } |
| 51 | ], |
| 52 | "terminal": true |
| 53 | }, |
| 54 | { |
| 55 | "match": [ |
| 56 | { |
| 57 | "host": [ |
| 58 | "automated2.example.com" |
| 59 | ] |
| 60 | } |
| 61 | ], |
| 62 | "handle": [ |
| 63 | { |
| 64 | "handler": "subroute", |
| 65 | "routes": [ |
| 66 | { |
| 67 | "handle": [ |
| 68 | { |
| 69 | "body": "Automated!", |
| 70 | "handler": "static_response" |
| 71 | } |
| 72 | ] |
| 73 | } |
| 74 | ] |
| 75 | } |
| 76 | ], |
| 77 | "terminal": true |
| 78 | }, |
| 79 | { |
| 80 | "match": [ |
| 81 | { |
| 82 | "host": [ |
| 83 | "shadowed.example.com" |
| 84 | ] |
| 85 | } |
| 86 | ], |
| 87 | "handle": [ |
| 88 | { |
| 89 | "handler": "subroute", |
| 90 | "routes": [ |
| 91 | { |
| 92 | "handle": [ |
| 93 | { |
| 94 | "body": "Shadowed!", |
| 95 | "handler": "static_response" |
| 96 | } |
| 97 | ] |
| 98 | } |
| 99 | ] |
| 100 | } |
| 101 | ], |
| 102 | "terminal": true |
| 103 | }, |
| 104 | { |
| 105 | "match": [ |
| 106 | { |
| 107 | "host": [ |
| 108 | "*.example.com" |
| 109 | ] |
| 110 | } |
| 111 | ], |
| 112 | "handle": [ |
| 113 | { |
| 114 | "handler": "subroute", |
| 115 | "routes": [ |
| 116 | { |
| 117 | "handle": [ |
| 118 | { |
| 119 | "body": "Wildcard!", |
| 120 | "handler": "static_response" |
| 121 | } |
| 122 | ] |
| 123 | } |
| 124 | ] |
| 125 | } |
| 126 | ], |
| 127 | "terminal": true |
| 128 | } |
| 129 | ], |
| 130 | "tls_connection_policies": [ |
| 131 | { |
| 132 | "match": { |
| 133 | "sni": [ |
| 134 | "automated1.example.com", |
| 135 | "automated2.example.com" |
| 136 | ] |
| 137 | } |
| 138 | }, |
| 139 | { |
| 140 | "match": { |
| 141 | "sni": [ |
| 142 | "*.example.com" |
| 143 | ] |
| 144 | }, |
| 145 | "certificate_selection": { |
| 146 | "any_tag": [ |
| 147 | "cert0" |
| 148 | ] |
| 149 | } |
| 150 | }, |
| 151 | {} |
| 152 | ] |
| 153 | } |
| 154 | } |
| 155 | }, |
| 156 | "tls": { |
| 157 | "certificates": { |
| 158 | "automate": [ |
| 159 | "automated1.example.com", |
| 160 | "automated2.example.com" |
| 161 | ], |
| 162 | "load_files": [ |
| 163 | { |
| 164 | "certificate": "cert.pem", |
| 165 | "key": "key.pem", |
| 166 | "tags": [ |
| 167 | "cert0" |
| 168 | ] |
| 169 | } |
| 170 | ] |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | } |