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 | :80 |
| 2 | |
| 3 | # All the options |
| 4 | encode gzip zstd { |
| 5 | minimum_length 256 |
| 6 | match { |
| 7 | status 2xx 4xx 500 |
| 8 | header Content-Type text/* |
| 9 | header Content-Type application/json* |
| 10 | header Content-Type application/javascript* |
| 11 | header Content-Type application/xhtml+xml* |
| 12 | header Content-Type application/atom+xml* |
| 13 | header Content-Type application/rss+xml* |
| 14 | header Content-Type application/wasm* |
| 15 | header Content-Type image/svg+xml* |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | # Long way with a block for each encoding |
| 20 | encode { |
| 21 | zstd { |
| 22 | disable_checksum |
| 23 | } |
| 24 | gzip 5 |
| 25 | } |
| 26 | |
| 27 | encode |
| 28 | ---------- |
| 29 | { |
| 30 | "apps": { |
| 31 | "http": { |
| 32 | "servers": { |
| 33 | "srv0": { |
| 34 | "listen": [ |
| 35 | ":80" |
| 36 | ], |
| 37 | "routes": [ |
| 38 | { |
| 39 | "handle": [ |
| 40 | { |
| 41 | "encodings": { |
| 42 | "gzip": {}, |
| 43 | "zstd": {} |
| 44 | }, |
| 45 | "handler": "encode", |
| 46 | "match": { |
| 47 | "headers": { |
| 48 | "Content-Type": [ |
| 49 | "text/*", |
| 50 | "application/json*", |
| 51 | "application/javascript*", |
| 52 | "application/xhtml+xml*", |
| 53 | "application/atom+xml*", |
| 54 | "application/rss+xml*", |
| 55 | "application/wasm*", |
| 56 | "image/svg+xml*" |
| 57 | ] |
| 58 | }, |
| 59 | "status_code": [ |
| 60 | 2, |
| 61 | 4, |
| 62 | 500 |
| 63 | ] |
| 64 | }, |
| 65 | "minimum_length": 256, |
| 66 | "prefer": [ |
| 67 | "gzip", |
| 68 | "zstd" |
| 69 | ] |
| 70 | }, |
| 71 | { |
| 72 | "encodings": { |
| 73 | "gzip": { |
| 74 | "level": 5 |
| 75 | }, |
| 76 | "zstd": { |
| 77 | "checksum": false |
| 78 | } |
| 79 | }, |
| 80 | "handler": "encode", |
| 81 | "prefer": [ |
| 82 | "zstd", |
| 83 | "gzip" |
| 84 | ] |
| 85 | }, |
| 86 | { |
| 87 | "encodings": { |
| 88 | "gzip": {}, |
| 89 | "zstd": {} |
| 90 | }, |
| 91 | "handler": "encode", |
| 92 | "prefer": [ |
| 93 | "zstd", |
| 94 | "gzip" |
| 95 | ] |
| 96 | } |
| 97 | ] |
| 98 | } |
| 99 | ] |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | } |