2019-04-08 15:14:08 +00:00
|
|
|
# RedirectScheme
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
Redirecting the Client to a Different Scheme/Port
|
|
|
|
{: .subtitle }
|
|
|
|
|
2019-09-10 12:40:05 +00:00
|
|
|
<!--
|
|
|
|
TODO: add schema
|
|
|
|
-->
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
RegexRedirect redirect request from a scheme to another.
|
|
|
|
|
|
|
|
## Configuration Examples
|
|
|
|
|
2019-04-03 12:32:04 +00:00
|
|
|
```yaml tab="Docker"
|
|
|
|
# Redirect to https
|
|
|
|
labels:
|
|
|
|
- "traefik.http.middlewares.test-redirectscheme.redirectscheme.scheme=https"
|
|
|
|
```
|
|
|
|
|
|
|
|
```yaml tab="Kubernetes"
|
|
|
|
# Redirect to https
|
|
|
|
apiVersion: traefik.containo.us/v1alpha1
|
|
|
|
kind: Middleware
|
|
|
|
metadata:
|
|
|
|
name: test-redirectscheme
|
|
|
|
spec:
|
|
|
|
redirectScheme:
|
|
|
|
scheme: https
|
|
|
|
```
|
|
|
|
|
2019-04-15 16:22:07 +00:00
|
|
|
```json tab="Marathon"
|
|
|
|
"labels": {
|
|
|
|
"traefik.http.middlewares.test-redirectscheme.redirectscheme.scheme": "https"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-04-08 15:14:08 +00:00
|
|
|
```yaml tab="Rancher"
|
|
|
|
# Redirect to https
|
|
|
|
labels:
|
|
|
|
- "traefik.http.middlewares.test-redirectscheme.redirectscheme.scheme=https"
|
|
|
|
```
|
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```toml tab="File (TOML)"
|
2019-04-03 12:32:04 +00:00
|
|
|
# Redirect to https
|
|
|
|
[http.middlewares]
|
2019-07-01 09:30:05 +00:00
|
|
|
[http.middlewares.test-redirectscheme.redirectScheme]
|
2019-04-03 12:32:04 +00:00
|
|
|
scheme = "https"
|
|
|
|
```
|
2019-02-26 13:50:07 +00:00
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```yaml tab="File (YAML)"
|
|
|
|
# Redirect to https
|
|
|
|
http:
|
|
|
|
middlewares:
|
|
|
|
test-redirectscheme:
|
|
|
|
redirectScheme:
|
|
|
|
scheme: https
|
|
|
|
```
|
|
|
|
|
2019-02-26 13:50:07 +00:00
|
|
|
## Configuration Options
|
|
|
|
|
2019-04-03 12:32:04 +00:00
|
|
|
### `permanent`
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
Set the `permanent` option to `true` to apply a permanent redirection.
|
|
|
|
|
2019-04-03 12:32:04 +00:00
|
|
|
### `scheme`
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
The `scheme` option defines the scheme of the new url.
|
|
|
|
|
2019-04-03 12:32:04 +00:00
|
|
|
### `port`
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
The `port` option defines the port of the new url.
|