WEBcoast Logo

Simple SSL redirect in Træfik with Docker

Often the goal is just to make the server redirect from HTTP to HTTPS, meaning from www.mydomain.com to www.mydomain.com.

Using Docker with docker-compose it is possible to change Træfik's behavior through the so called "labels". To make Træfik redirect from HTTP to HTTPS it is enough to set the following label:

"traefik.frontend.headers.SSLRedirect": true

At the same time

"traefik.default.protocol": "http"

must not be set.