traefik/docs/content/middlewares/replacepath.md

71 lines
1.3 KiB
Markdown
Raw Normal View History

2019-04-08 15:14:08 +00:00
# ReplacePath
Updating the Path Before Forwarding the Request
{: .subtitle }
2019-09-10 12:40:05 +00:00
<!--
TODO: add schema
-->
Replace the path of the request url.
## Configuration Examples
2019-04-03 12:32:04 +00:00
```yaml tab="Docker"
# Replace the path by /foo
labels:
2019-09-23 15:00:06 +00:00
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
2019-04-03 12:32:04 +00:00
```
```yaml tab="Kubernetes"
# Replace the path by /foo
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-replacepath
spec:
replacePath:
path: /foo
```
```json tab="Marathon"
"labels": {
"traefik.http.middlewares.test-replacepath.replacepath.path": "/foo"
}
```
2019-04-08 15:14:08 +00:00
```yaml tab="Rancher"
# Replace the path by /foo
labels:
2019-09-23 15:00:06 +00:00
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
2019-04-08 15:14:08 +00:00
```
2019-07-22 07:58:04 +00:00
```toml tab="File (TOML)"
2019-04-03 12:32:04 +00:00
# Replace the path by /foo
[http.middlewares]
2019-07-01 09:30:05 +00:00
[http.middlewares.test-replacepath.replacePath]
path = "/foo"
2019-04-03 12:32:04 +00:00
```
2019-07-22 07:58:04 +00:00
```yaml tab="File (YAML)"
# Replace the path by /foo
http:
middlewares:
test-replacepath:
replacePath:
path: "/foo"
```
## Configuration Options
### General
The ReplacePath middleware will:
2019-04-08 15:14:08 +00:00
- replace the actual path by the specified one.
- store the original path in a `X-Replaced-Path` header.
2019-04-03 12:32:04 +00:00
### `path`
The `path` option defines the path to use as replacement in the request url.