github.com/mholt/caddy-l4@v0.0.0-20241104153248-ec8fae209322/integration/caddyfile_adapt/gd_handler_tls.caddytest (about) 1 { 2 layer4 { 3 :443 { 4 @h1 tls alpn http/1 http/1.1 5 route @h1 { 6 tls 7 subroute { 8 @alpha http host alpha.example.com 9 route @alpha { 10 proxy alpha.machine.local:80 11 } 12 @beta http host beta.example.com 13 route @beta { 14 proxy beta.machine.local:80 15 } 16 route { 17 proxy gamma.machine.local:80 18 } 19 } 20 } 21 @h2a tls { 22 alpn http/2 23 sni alpha.example.com 24 } 25 route @h2a { 26 tls { 27 connection_policy { 28 curves x25519 29 cert_selection { 30 serial_number 123456789012 31 } 32 } 33 } 34 proxy alpha.machine.local:80 35 } 36 @h2b tls { 37 alpn http/2 38 sni beta.example.com 39 } 40 route @h2b { 41 tls { 42 connection_policy { 43 curves secp256r1 44 cert_selection { 45 serial_number 123456789012 46 } 47 } 48 } 49 proxy beta.machine.local:80 50 } 51 route { 52 echo 53 } 54 } 55 } 56 } 57 ---------- 58 { 59 "apps": { 60 "layer4": { 61 "servers": { 62 "srv0": { 63 "listen": [ 64 ":443" 65 ], 66 "routes": [ 67 { 68 "match": [ 69 { 70 "tls": { 71 "alpn": [ 72 "http/1", 73 "http/1.1" 74 ] 75 } 76 } 77 ], 78 "handle": [ 79 { 80 "handler": "tls" 81 }, 82 { 83 "handler": "subroute", 84 "routes": [ 85 { 86 "handle": [ 87 { 88 "handler": "proxy", 89 "upstreams": [ 90 { 91 "dial": [ 92 "alpha.machine.local:80" 93 ] 94 } 95 ] 96 } 97 ], 98 "match": [ 99 { 100 "http": [ 101 { 102 "host": [ 103 "alpha.example.com" 104 ] 105 } 106 ] 107 } 108 ] 109 }, 110 { 111 "handle": [ 112 { 113 "handler": "proxy", 114 "upstreams": [ 115 { 116 "dial": [ 117 "beta.machine.local:80" 118 ] 119 } 120 ] 121 } 122 ], 123 "match": [ 124 { 125 "http": [ 126 { 127 "host": [ 128 "beta.example.com" 129 ] 130 } 131 ] 132 } 133 ] 134 }, 135 { 136 "handle": [ 137 { 138 "handler": "proxy", 139 "upstreams": [ 140 { 141 "dial": [ 142 "gamma.machine.local:80" 143 ] 144 } 145 ] 146 } 147 ] 148 } 149 ] 150 } 151 ] 152 }, 153 { 154 "match": [ 155 { 156 "tls": { 157 "alpn": [ 158 "http/2" 159 ], 160 "sni": [ 161 "alpha.example.com" 162 ] 163 } 164 } 165 ], 166 "handle": [ 167 { 168 "connection_policies": [ 169 { 170 "certificate_selection": { 171 "serial_number": [ 172 "123456789012" 173 ] 174 }, 175 "curves": [ 176 "x25519" 177 ] 178 } 179 ], 180 "handler": "tls" 181 }, 182 { 183 "handler": "proxy", 184 "upstreams": [ 185 { 186 "dial": [ 187 "alpha.machine.local:80" 188 ] 189 } 190 ] 191 } 192 ] 193 }, 194 { 195 "match": [ 196 { 197 "tls": { 198 "alpn": [ 199 "http/2" 200 ], 201 "sni": [ 202 "beta.example.com" 203 ] 204 } 205 } 206 ], 207 "handle": [ 208 { 209 "connection_policies": [ 210 { 211 "certificate_selection": { 212 "serial_number": [ 213 "123456789012" 214 ] 215 }, 216 "curves": [ 217 "secp256r1" 218 ] 219 } 220 ], 221 "handler": "tls" 222 }, 223 { 224 "handler": "proxy", 225 "upstreams": [ 226 { 227 "dial": [ 228 "beta.machine.local:80" 229 ] 230 } 231 ] 232 } 233 ] 234 }, 235 { 236 "handle": [ 237 { 238 "handler": "echo" 239 } 240 ] 241 } 242 ] 243 } 244 } 245 } 246 } 247 }