envoyproxy / envoyproxy/gateway
Allow rewriting path from header value
- Dominant language
- Go
- Stars
- 3k
- Forks
- 864
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 140
Description
### Description:
I would like to be able to rewrite path of the request with the value of some header. Now it is only possible to rewrite hostname with header.
Currently only options to rewrite path are
```k explain httproute.spec.rules.filters.urlRewrite.path``` ReplaceFullPath, ReplacePrefixMatch
or with envoy-gateway's HTTPRouteFilter
```k explain httproutefilter.spec.urlRewrite.path.replaceRegexMatch```
HTTPRoute
```yaml
...
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplaceFullPath
replaceFullPath: "/literal/path"
...
```
-> httproute.spec.rules.filters.urlRewrite.path ReplaceFullPath and httproutefilter.spec.urlRewrite.path.replaceRegexMatch are both translated to routeAction [regex_rewrite](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-field-config-route-v3-routeaction-regex-rewrite)
```yaml
...
route:
regexRewrite:
pattern:
regex: ^/.*$
substitution: /literal/path
...
```
I would like to use [path_rewrite](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-field-config-route-v3-routeaction-path-rewrite) instead and use Envoy's substitution format specifiers
example:
```yaml
...
hostnames:
- "*.example.com"
rules:
- matches:
- path:
type: PathPrefix
value: /test/
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplaceFullPath
replaceFullPath: "/bucketname/%REQ(:authority)%/%REQ(X-Envoy-Original-Path)%/index.html"
hostname: "storage.googleapis.com"
backendRefs:
- kind: Backend
name: storage-google
...
```
Is it possible to pass subdomain/host to path on rewrite some other way?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.