traefik配置demo
- middleware-ipwhitelist
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
77apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: ipwhitelist
spec:
ipWhiteList:
sourceRange:
- 127.0.0.1/32
```
* middleware-stripprefix
```shell
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: stripprefix
spec:
stripPrefix:
prefixes:
- /admin
```
* middleware-hstsheader
```shell
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: hstsheader
spec:
headers:
accessControlMaxAge: 100
addVaryHeader: true
stsSeconds: 31536000
stsIncludeSubdomains: true
stsPreload: true
forceSTSHeader: true
accessControlAllowCredentials: true
accessControlAllowOriginList:
- "baiud.com"
accessControlExposeHeaders:
customRequestHeaders:
hello: "world"
accessControlAllowMethods:
- "GET"
- "POST"
- "PUT"
- "OPTIONS"
- "DELETE"
accessControlAllowHeaders:
- content-type
- x-requested-with
- timeoffset
```
* ingressroute
```shell
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: ingressroute
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(`a.com`) && PathPrefix(`/a`)
priority: 20
middlewares:
- name: stripprefix
services:
- kind: Service
name: api
port: 9443
scheme: https
tls:
store:
name: default
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 符十三郎!