forked from praxis-proxy/praxis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompression.yaml
More file actions
53 lines (51 loc) · 1.78 KB
/
Copy pathcompression.yaml
File metadata and controls
53 lines (51 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Response Compression
#
# Enables transparent response compression using Pingora's built-in
# compression module. Supports gzip, brotli, and zstd algorithms.
# Compression is negotiated via Accept-Encoding / Content-Encoding
# headers automatically.
#
# Responses are compressed only when:
# - The client sends an Accept-Encoding header
# - The response Content-Type matches the allowlist
# - The response Content-Length exceeds min_size_bytes (or is chunked)
# - The response is not already compressed (no Content-Encoding)
#
# Usage:
# cargo run -p praxis-proxy -- -c examples/configs/payload-processing/compression.yaml
# curl -H "Accept-Encoding: gzip" http://localhost:8080/
listeners:
- name: default
address: "127.0.0.1:8080"
filter_chains:
- main
filter_chains:
- name: main
filters:
- filter: compression
level: 6 # default level; per-algorithm levels override
min_size_bytes: 256
gzip: # broadest client compatibility
enabled: true
level: 6 # 1-9; higher = better ratio, slower
brotli: # best compression ratio for text
enabled: true
level: 4 # 0-11; higher = better ratio, slower
zstd: # fastest compression/decompression
enabled: true
level: 3 # 1-22; higher = better ratio, slower
content_types:
- "text/"
- "application/json"
- "application/javascript"
- "application/xml"
- "application/wasm"
- filter: router
routes:
- path_prefix: "/"
cluster: backend
- filter: load_balancer
clusters:
- name: backend
endpoints:
- "127.0.0.1:3000"