RedirectScheme
The RedirectScheme middleware redirects the request if the request scheme is different from the configured scheme.
When behind another reverse-proxy
When there is at least one other reverse-proxy between the client and Traefik, the other reverse-proxy (for example, the last hop) needs to be a [trusted] one.
Otherwise, Traefik would clean up the X-Forwarded headers coming from this last hop, and as the RedirectScheme middleware relies on them to determine the scheme used, it would not function as intended.
Configuration Example
- Middleware RedirectScheme
301 to https
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-redirectscheme
spec:
redirectScheme:
scheme: https
permanent: true
Configuration Options
Field | Description | Default | Required |
---|---|---|---|
scheme | Scheme of the new URL. | "" | Yes |
permanent | Enable a permanent redirection. | false | No |
port | Port of the new URL. Set a string, not a numeric value. | "" | No |