Repository navigation
Expand file tree
/
Copy pathconfig.yaml
More file actions
89 lines (82 loc) · 2.75 KB
/
Copy pathconfig.yaml
File metadata and controls
89 lines (82 loc) · 2.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
routes:
/first:
upstreams:
- "http://localhost:8081"
- "http://localhost:8082"
- "http://localhost:8084"
lb_strategy: "round_robin"
healthcheck_interval_seconds: 5
middleware:
- rate_limiter:
max_requests: 4
window_size_seconds: 30
/second:
upstreams: ["http://127.0.0.1:8083", "http://127.0.0.1:8085"]
healthcheck_interval_seconds: 10
healthcheck_path: "/healthz" # omit to default to "/"
middleware:
- rate_limiter:
max_requests: 2
window_size_seconds: 60
- basic_auth:
file: ./examples/basic_auth
- waf:
mode: block # "block" (default) | "log"
rules: # omit to enable all; or list a subset:
- sql_injection
- xss
- path_traversal
- command_injection
max_body_bytes: 65536 # bytes of request body to inspect
- cache_control:
duration: 30s
# Middleware is an ordered list. The proxy reorders entries by phase
# (observe -> guard -> authenticate -> shape -> cache); within a phase your
# list order is kept and a type may repeat (e.g. multiple headers/rewrite).
# weighted_round_robin example: :8081 gets ~75% of traffic, :8082 gets ~25%
# /weighted:
# upstreams:
# - "http://localhost:8081"
# - "http://localhost:8082"
# lb_strategy: "weighted_round_robin"
# weights:
# "http://localhost:8081": 3
# "http://localhost:8082": 1
# least_connections example: traffic goes to the upstream with fewest active requests
# /least:
# upstreams:
# - "http://localhost:8081"
# - "http://localhost:8082"
# lb_strategy: "least_connections"
# ip_hash example: same client IP always hits the same upstream
# /sticky:
# upstreams:
# - "http://localhost:8081"
# - "http://localhost:8082"
# lb_strategy: "ip_hash"
# headers middleware: manipulate request/response headers
# /headers-example:
# upstreams: ["http://localhost:8081"]
# middleware:
# - headers:
# request:
# set:
# X-Internal-Source: reverse-proxy
# remove:
# - X-Forwarded-For # strip before trusting upstream
# response:
# set:
# X-Frame-Options: DENY
# X-Content-Type-Options: nosniff
# remove:
# - Server # hide upstream identity
# rewrite middleware: rewrite request path before forwarding (first match wins)
# /rewrite-example:
# upstreams: ["http://localhost:8081"]
# middleware:
# - rewrite:
# rules:
# - match: "^/api/v1/(.*)"
# replace: "/v1/$1"
# - match: "^/legacy/(.*)"
# replace: "/$1"