docker-compose labels require $'s to be escaped

This commit is contained in:
Connor Bell 2019-08-20 16:08:05 +01:00 committed by Traefiker Bot
parent 16bd0b9ca8
commit 99797502eb

View file

@ -13,7 +13,7 @@ RegexRedirect redirect a request from an url to another with regex matching and
# Redirect with domain replacement # Redirect with domain replacement
labels: labels:
- "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^http://localhost/(.*)" - "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^http://localhost/(.*)"
- "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=http://mydomain/$1" - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=http://mydomain/$${1}"
``` ```
```yaml tab="Kubernetes" ```yaml tab="Kubernetes"
@ -25,13 +25,13 @@ metadata:
spec: spec:
redirectRegex: redirectRegex:
regex: ^http://localhost/(.*) regex: ^http://localhost/(.*)
replacement: http://mydomain/$1 replacement: http://mydomain/${1}
``` ```
```json tab="Marathon" ```json tab="Marathon"
"labels": { "labels": {
"traefik.http.middlewares.test-redirectregex.redirectregex.regex": "^http://localhost/(.*)", "traefik.http.middlewares.test-redirectregex.redirectregex.regex": "^http://localhost/(.*)",
"traefik.http.middlewares.test-redirectregex.redirectregex.replacement": "http://mydomain/$1" "traefik.http.middlewares.test-redirectregex.redirectregex.replacement": "http://mydomain/${1}"
} }
``` ```
@ -39,7 +39,7 @@ spec:
# Redirect with domain replacement # Redirect with domain replacement
labels: labels:
- "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^http://localhost/(.*)" - "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^http://localhost/(.*)"
- "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=http://mydomain/$1" - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=http://mydomain/${1}"
``` ```
```toml tab="File (TOML)" ```toml tab="File (TOML)"
@ -47,7 +47,7 @@ labels:
[http.middlewares] [http.middlewares]
[http.middlewares.test-redirectregex.redirectRegex] [http.middlewares.test-redirectregex.redirectRegex]
regex = "^http://localhost/(.*)" regex = "^http://localhost/(.*)"
replacement = "http://mydomain/$1" replacement = "http://mydomain/${1}"
``` ```
```yaml tab="File (YAML)" ```yaml tab="File (YAML)"
@ -57,7 +57,7 @@ http:
test-redirectregex: test-redirectregex:
redirectRegex: redirectRegex:
regex: "^http://localhost/(.*)" regex: "^http://localhost/(.*)"
replacement: "http://mydomain/$1" replacement: "http://mydomain/${1}"
``` ```
## Configuration Options ## Configuration Options
@ -80,5 +80,5 @@ The `regex` option is the regular expression to match and capture elements from
### `replacement` ### `replacement`
The `replacement` option defines how to modify the URl to have the new target URL. The `replacement` option defines how to modify the URL to have the new target URL.