Global HTTP Redirect in Traefik 2
I'm setting up traefik 2 using a docker-compose file. In order to redirect all HTTP traffic to the equivalent HTTPS address, we can setup the following configuration as labels in the docker-compose file.
In the above configuration, there is a reference to the
web entrypoint. This is configured via the
entryPoints entry in
The advantage of this configuration is that you don't have to do redirects on a per service / route level and there is a single configuration that applies to all providers e.g. docker, kubernetes, file.
Of course, if you have a few services that you must use HTTP for, you will have to figure out a workaround.