Your cart is currently empty!
Kubernetes: GatewayAPI URLRewrite Filter
In this example, request to /echo
or /echo/
(because of the type: PathPrefix
) will be rewritten as /
and becomes the request of “web” Service.
YAML
x
22
22
1
apiVersion gateway.networking.k8s.io/v1
2
kind HTTPRoute
3
metadata
4
name web
5
spec
6
parentRefs
7
name nginx
8
rules
9
matches
10
path
11
type PathPrefix
12
value /echo
13
backendRefs
14
name web
15
kind Service
16
port80
17
filters
18
type URLRewrite
19
urlRewrite
20
path
21
type ReplacePrefixMatch
22
replacePrefixMatch /
In this example, request only to /echo
(because of the type: Exact
) will be rewritten as /
and becomes the request of “web” Service.
YAML
1
22
22
1
apiVersion gateway.networking.k8s.io/v1
2
kind HTTPRoute
3
metadata
4
name web
5
spec
6
parentRefs
7
name nginx
8
rules
9
matches
10
path
11
type Exact
12
value /echo
13
backendRefs
14
name web
15
kind Service
16
port80
17
filters
18
type URLRewrite
19
urlRewrite
20
path
21
type ReplaceFullPath
22
replaceFullPath /
Leave a Reply