Mention escaping escape characters in YAML for regex usage
This commit is contained in:
parent
918a343557
commit
5d716f0149
5 changed files with 24 additions and 10 deletions
|
@ -284,6 +284,12 @@ http:
|
||||||
authResponseHeadersRegex = "^X-"
|
authResponseHeadersRegex = "^X-"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
||||||
|
|
||||||
|
When defining a regular expression within YAML, any escaped character needs to be escaped twice: `example\.com` needs to be written as `example\\.com`.
|
||||||
|
|
||||||
### `authRequestHeaders`
|
### `authRequestHeaders`
|
||||||
|
|
||||||
The `authRequestHeaders` option is the list of the headers to copy from the request to the authentication server.
|
The `authRequestHeaders` option is the list of the headers to copy from the request to the authentication server.
|
||||||
|
|
|
@ -333,7 +333,9 @@ It allows all origins that contain any match of a regular expression in the `acc
|
||||||
|
|
||||||
!!! tip
|
!!! tip
|
||||||
|
|
||||||
Regular expressions can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
||||||
|
|
||||||
|
When defining a regular expression within YAML, any escaped character needs to be escaped twice: `example\.com` needs to be written as `example\\.com`.
|
||||||
|
|
||||||
### `accessControlExposeHeaders`
|
### `accessControlExposeHeaders`
|
||||||
|
|
||||||
|
|
|
@ -73,10 +73,6 @@ http:
|
||||||
|
|
||||||
## Configuration Options
|
## Configuration Options
|
||||||
|
|
||||||
!!! tip
|
|
||||||
|
|
||||||
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
|
||||||
|
|
||||||
### `permanent`
|
### `permanent`
|
||||||
|
|
||||||
Set the `permanent` option to `true` to apply a permanent redirection.
|
Set the `permanent` option to `true` to apply a permanent redirection.
|
||||||
|
@ -85,6 +81,12 @@ Set the `permanent` option to `true` to apply a permanent redirection.
|
||||||
|
|
||||||
The `regex` option is the regular expression to match and capture elements from the request URL.
|
The `regex` option is the regular expression to match and capture elements from the request URL.
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
||||||
|
|
||||||
|
When defining a regular expression within YAML, any escaped character needs to be escaped twice: `example\.com` needs to be written as `example\\.com`.
|
||||||
|
|
||||||
### `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.
|
||||||
|
|
|
@ -79,7 +79,9 @@ The ReplacePathRegex middleware will:
|
||||||
|
|
||||||
!!! tip
|
!!! tip
|
||||||
|
|
||||||
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or [Regex101](https://regex101.com/r/58sIgx/2).
|
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
||||||
|
|
||||||
|
When defining a regular expression within YAML, any escaped character needs to be escaped twice: `example\.com` needs to be written as `example\\.com`.
|
||||||
|
|
||||||
### `regex`
|
### `regex`
|
||||||
|
|
||||||
|
|
|
@ -67,11 +67,13 @@ The StripPrefixRegex middleware strips the matching path prefix and stores it in
|
||||||
|
|
||||||
The `regex` option is the regular expression to match the path prefix from the request URL.
|
The `regex` option is the regular expression to match the path prefix from the request URL.
|
||||||
|
|
||||||
!!! tip
|
|
||||||
|
|
||||||
Regular expressions can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
|
||||||
|
|
||||||
For instance, `/products` also matches `/products/shoes` and `/products/shirts`.
|
For instance, `/products` also matches `/products/shoes` and `/products/shirts`.
|
||||||
|
|
||||||
If your backend is serving assets (e.g., images or JavaScript files), it can use the `X-Forwarded-Prefix` header to properly construct relative URLs.
|
If your backend is serving assets (e.g., images or JavaScript files), it can use the `X-Forwarded-Prefix` header to properly construct relative URLs.
|
||||||
Using the previous example, the backend should return `/products/shoes/image.png` (and not `/images.png`, which Traefik would likely not be able to associate with the same backend).
|
Using the previous example, the backend should return `/products/shoes/image.png` (and not `/images.png`, which Traefik would likely not be able to associate with the same backend).
|
||||||
|
|
||||||
|
!!! tip
|
||||||
|
|
||||||
|
Regular expressions and replacements can be tested using online tools such as [Go Playground](https://play.golang.org/p/mWU9p-wk2ru) or the [Regex101](https://regex101.com/r/58sIgx/2).
|
||||||
|
|
||||||
|
When defining a regular expression within YAML, any escaped character needs to be escaped twice: `example\.com` needs to be written as `example\\.com`.
|
||||||
|
|
Loading…
Reference in a new issue