traefik/docs/content/middlewares/addprefix.md

53 lines
1,006 B
Markdown
Raw Normal View History

# Add Prefix
Prefixing the Path
{: .subtitle }
![AddPrefix](../assets/img/middleware/addprefix.png)
The AddPrefix middleware updates the URL Path of the request before forwarding it.
## Configuration Examples
2019-03-29 12:34:05 +01:00
```yaml tab="Docker"
# Prefixing with /foo
labels:
2019-04-03 14:32:04 +02:00
- "traefik.http.middlewares.add-foo.addprefix.prefix=/foo"
2019-03-29 12:34:05 +01:00
```
```yaml tab="Kubernetes"
2019-04-03 14:32:04 +02:00
# Prefixing with /foo
2019-03-29 12:34:05 +01:00
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
2019-04-03 14:32:04 +02:00
name: add-foo
2019-03-29 12:34:05 +01:00
spec:
2019-04-03 14:32:04 +02:00
addPrefix:
prefix: /foo
2019-03-29 12:34:05 +01:00
```
```json tab="Marathon"
"labels": {
"traefik.http.middlewares.add-foo.addprefix.prefix": "/foo"
}
```
2019-04-08 17:14:08 +02:00
```yaml tab="Rancher"
# Prefixing with /foo
labels:
- "traefik.http.middlewares.add-foo.addprefix.prefix=/foo"
```
2019-03-29 12:34:05 +01:00
```toml tab="File"
# Prefixing with /foo
[http.middlewares]
2019-07-01 11:30:05 +02:00
[http.middlewares.add-foo.addPrefix]
prefix = "/foo"
2019-03-29 12:34:05 +01:00
```
## Configuration Options
2019-04-03 14:32:04 +02:00
### `prefix`
`prefix` is the string to add before the current path in the requested URL. It should include the leading slash (`/`).