Skip to main content

Redirect the requests

The example below shows how to redirect the HTTP requests on the port 80 to the port 443, changing the scheme into HTTPS. You can apply the redirection either at the EntryPoint level to redirect every request or on a router, using a middleware.

Redirect from Entrypoints

Redirect every request from the entrypoint web to websecure.

## Static configuration
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https

websecure:
address: :443
tls: {}

Redirect from Routers

Redirect every request from the entrypoint web to the port 443 for the dedicated IngressRoute. In such a case, every request that matches the rule is redirected between the entrypoints.

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-redirectscheme
spec:
redirectScheme:
scheme: https
port: "443"