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 | https://example.com { |
| 2 | reverse_proxy /path https://localhost:54321 { |
| 3 | header_up Host {upstream_hostport} |
| 4 | header_up Foo bar |
| 5 | |
| 6 | method GET |
| 7 | rewrite /rewritten?uri={uri} |
| 8 | |
| 9 | request_buffers 4KB |
| 10 | |
| 11 | transport http { |
| 12 | read_buffer 10MB |
| 13 | write_buffer 20MB |
| 14 | max_response_header 30MB |
| 15 | dial_timeout 3s |
| 16 | dial_fallback_delay 5s |
| 17 | response_header_timeout 8s |
| 18 | expect_continue_timeout 9s |
| 19 | resolvers 8.8.8.8 8.8.4.4 |
| 20 | |
| 21 | versions h2c 2 |
| 22 | compression off |
| 23 | max_conns_per_host 5 |
| 24 | keepalive_idle_conns_per_host 2 |
| 25 | keepalive_interval 30s |
| 26 | |
| 27 | tls_renegotiation freely |
| 28 | tls_except_ports 8181 8182 |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | ---------- |
| 33 | { |
| 34 | "apps": { |
| 35 | "http": { |
| 36 | "servers": { |
| 37 | "srv0": { |
| 38 | "listen": [ |
| 39 | ":443" |
| 40 | ], |
| 41 | "routes": [ |
| 42 | { |
| 43 | "match": [ |
| 44 | { |
| 45 | "host": [ |
| 46 | "example.com" |
| 47 | ] |
| 48 | } |
| 49 | ], |
| 50 | "handle": [ |
| 51 | { |
| 52 | "handler": "subroute", |
| 53 | "routes": [ |
| 54 | { |
| 55 | "handle": [ |
| 56 | { |
| 57 | "handler": "reverse_proxy", |
| 58 | "headers": { |
| 59 | "request": { |
| 60 | "set": { |
| 61 | "Foo": [ |
| 62 | "bar" |
| 63 | ], |
| 64 | "Host": [ |
| 65 | "{http.reverse_proxy.upstream.hostport}" |
| 66 | ] |
| 67 | } |
| 68 | } |
| 69 | }, |
| 70 | "request_buffers": 4000, |
| 71 | "rewrite": { |
| 72 | "method": "GET", |
| 73 | "uri": "/rewritten?uri={http.request.uri}" |
| 74 | }, |
| 75 | "transport": { |
| 76 | "compression": false, |
| 77 | "dial_fallback_delay": 5000000000, |
| 78 | "dial_timeout": 3000000000, |
| 79 | "expect_continue_timeout": 9000000000, |
| 80 | "keep_alive": { |
| 81 | "max_idle_conns_per_host": 2, |
| 82 | "probe_interval": 30000000000 |
| 83 | }, |
| 84 | "max_conns_per_host": 5, |
| 85 | "max_response_header_size": 30000000, |
| 86 | "protocol": "http", |
| 87 | "read_buffer_size": 10000000, |
| 88 | "resolver": { |
| 89 | "addresses": [ |
| 90 | "8.8.8.8", |
| 91 | "8.8.4.4" |
| 92 | ] |
| 93 | }, |
| 94 | "response_header_timeout": 8000000000, |
| 95 | "tls": { |
| 96 | "except_ports": [ |
| 97 | "8181", |
| 98 | "8182" |
| 99 | ], |
| 100 | "renegotiation": "freely" |
| 101 | }, |
| 102 | "versions": [ |
| 103 | "h2c", |
| 104 | "2" |
| 105 | ], |
| 106 | "write_buffer_size": 20000000 |
| 107 | }, |
| 108 | "upstreams": [ |
| 109 | { |
| 110 | "dial": "localhost:54321" |
| 111 | } |
| 112 | ] |
| 113 | } |
| 114 | ], |
| 115 | "match": [ |
| 116 | { |
| 117 | "path": [ |
| 118 | "/path" |
| 119 | ] |
| 120 | } |
| 121 | ] |
| 122 | } |
| 123 | ] |
| 124 | } |
| 125 | ], |
| 126 | "terminal": true |
| 127 | } |
| 128 | ] |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } |