-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.traefik.yml
43 lines (39 loc) · 1.25 KB
/
.traefik.yml
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
displayName: Inline Response Plugin
type: middleware
iconPath: .assets/icon.png
bannerPath: .assets/banner.jpg
import: github.com/tuxgal/traefik_inline_response
summary: A highly configurable Traefik middleware plugin that can be used to return a response inline based on the configuration without any backend / service. Responses can be configured based on absolute, prefix or regex based paths. Response status code, headers and body can be configured per matcher rule. The response body can also be dynamically generated based on go templates based on the request.
testData:
matchers:
- path:
abs: /foo1
statusCode: 404
response:
raw: Not-Found-foo1
- path:
prefix: /foobar
statusCode: 200
response:
json:
f1: v1
f2: 23
f3:
f4: 567
f5:
- f6: v2
f7: v3
- f8: v4
f9: 890
- path:
regex: '^.*/foo/bar/.*$'
statusCode: 403
response:
template: '{{ .Method }}-{{ .URL.Scheme }}-{{ .URL.Host }}-{{ .URL.Path }}'
- path:
regex: '^/foo2/.+$'
statusCode: 409
fallback:
statusCode: 204
response:
template: '{{ .Proto }}-{{ .URL.Path }}'