Automatically redirect HTTP to HTTPS
Up until now, we would need to specify if we want to access the secure or insecure version of the page. In addition we would need to specify two routers for each service, one for the web entrypoint and one for the websecure entrypoint. We can avoid both if we tell traefik to automatically redirect every request that is getting to the web entrypoint.
For this simply add the following under entryPoints: web
inside the config/traefik.yml
file.
http:
redirections:
entrypoint:
to: websecure
scheme: https
This will let traefik know to automatically redirect every request at the web entrypoint to the websecure entrypoint.