Overview
In the following article, I introduced an example of running HTTPS-enabled containers using Traefik.
However, (this has since been fixed) the setting to redirect HTTP connections to HTTPS was missing, and accessing port 80 resulted in a “not found” error.
This is a memorandum on how to fix this issue.
Before the Change
log:
# level: DEBUG
entryPoints:
web:
address: :80
websecure:
address: :443
api:
dashboard: true
providers:
docker:
exposedByDefault: false
certificatesResolvers:
myresolver:
acme:
email: aaa@bbb
storage: /acme.json
caServer: https://acme-v02.api.letsencrypt.org/directory
# caServer: https://acme-staging-v02.api.letsencrypt.org/directory
httpChallenge:
entryPoint: web
After the Change
log:
# level: DEBUG
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
schema: https
permanent: true
websecure:
address: :443
api:
dashboard: true
providers:
docker:
exposedByDefault: false
certificatesResolvers:
myresolver:
acme:
email: na.kamura.1263@gmail.com
storage: /acme.json
caServer: https://acme-v02.api.letsencrypt.org/directory
# caServer: https://acme-staging-v02.api.letsencrypt.org/directory
httpChallenge:
entryPoint: web
In the entryPoints section, the redirect configuration has been added as follows:
...
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
schema: https
permanent: true
...
Summary
There may be better approaches or considerations I have missed, but I hope this serves as a useful reference.