forked from easegress-io/easegress
-
Notifications
You must be signed in to change notification settings - Fork 1
/
http-pipeline-example.yaml
136 lines (134 loc) · 3.07 KB
/
http-pipeline-example.yaml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: http-pipeline-example
kind: HTTPPipeline
# Built-in labels are `END` which can't be used by filters.
flow:
- filter: validator
jumpIf: { invalid: END }
# - filter: fallback
- filter: rateLimiter
- filter: requestAdaptor
- filter: proxy
jumpIf: { fallback: END }
- filter: responseAdaptor
filters:
- name: validator
kind: Validator
headers:
Content-Type:
values:
- application/json
regexp: ""
User-Agent:
values: []
regexp: .+
X-Filter:
values:
- ""
- mirror
- candidate
- hacking
regexp: ""
- name: fallback
kind: Fallback
mockCode: 200
mockHeaders:
Content-Type: applicaion/json
X-Fallback: Okay
mockBody: '{"message": "The feature turned off, please try it later."}'
- name: rateLimiter
kind: RateLimiter
policies:
- name: policy-one
timeoutDuration: 1000ms
limitRefreshPeriod: 5000ms
limitForPeriod: 2
- name: policy-two
timeoutDuration: 100ms
limitRefreshPeriod: 10ms
limitForPeriod: 30
defaultPolicyRef: policy-one
urls:
- methods: [GET, POST, PUT, DELETE]
url:
regex: ^/pipeline/.+$
policyRef: policy-one
- methods: [GET, POST, PUT, DELETE]
url:
exact: /pipeline/activity/2
policyRef: policy-two
- name: requestAdaptor
kind: RequestAdaptor
host: dev.megaease.com
method: ""
path: null
header:
del: []
set:
X-Adapt-Key: goodplan
add: {}
- name: proxy
kind: Proxy
failureCodes: [500, 501]
fallback:
forCodes: true
forCircuitBreaker: false
mockCode: 200
mockHeader: {X-Fallback: yes}
mockBody: '{"message": "Backend failed, try it later."}'
mirrorPool:
servers:
- url: http:https://127.0.0.1:9091
- url: http:https://127.0.0.1:9092
loadBalance:
policy: roundRobin
headerHashKey: ""
filter:
headers:
X-Filter:
exact: mirror
candidatePool:
servers:
- url: http:https://127.0.0.1:9093
- url: http:https://127.0.0.1:9094
loadBalance:
policy: random
headerHashKey: ""
memoryCache: null
filter:
headers:
X-Filter:
exact: candidate
mainPool:
serversTags: ["v2"]
servers:
- url: http:https://127.0.0.1:9095
tags: ["blue", "v2"]
- url: http:https://127.0.0.1:9096
tags: ["v2"]
- url: http:https://127.0.0.1:9097
tags: ["green", "v2"]
- url: http:https://127.0.0.1:9098
tags: ["green", "v2"]
loadBalance:
policy: roundRobin
headerHashKey: X-User-Id
# memoryCache:
# expiration: 10s
# maxEntryBytes: 4096
# size: 100
# codes:
# - 200
# - 201
# methods:
# - GET
# - HEAD
compression:
minLength: 1024
- name: responseAdaptor
kind: ResponseAdaptor
header:
del: []
set:
Server: Easegress v1.0.0
add:
X-Proxy-Name: http-proxy-exmaple