Hello!
I host a bunch of sites on docker behind a traefik reverse proxy, using letsencrypt to provide https for them. This all works perfectly smoothly using a combination of command line arguments and docker labels, general setup goes on the traefik command line/labels and the host-specific config goes in the container compose file, generally something on the line of:
labels:
- "traefik.http.routers.example.rule=Host(`www.example.com`) || Host(`example.com`)"
- "traefik.http.routers.example.tls=true"
- "traefik.http.routers.example.tls.certresolver=le"
- "traefik.http.routers.example.entryPoints=https"
- "traefik.http.routers.example.middlewares=redirect-to-www"
- "traefik.http.routers.example80.rule=Host(`www.example.com`) || Host(`example.com`)"
- "traefik.http.routers.example80.entryPoints=http"
- "traefik.http.routers.example80.middlewares=redirect-to-www,redirect-to-https"
However, I have a large update upcoming that will affect all sites and I want to place a simple notice to any visitors that we're currently having some maintenance.
I was easily able to do this for http by giving a new container with a maintenance page labels that gives it priority over everything else:
labels:
- "traefik.http.routers.maintenance.rule=HostRegexp(`.*`)"
- "traefik.http.routers.maintenance.priority=2000"
- "traefik.http.services.maintenance.loadbalancer.server.port=8001"
However, this only works for http, my attempts to use a second route like I usually do to the container to catch https-traffic have all failed, presumably because traefik can't extract a hostname to construct a LE request for the container and thus just ignores the https part (and in this case, I would much prefer it to re-use the existing certificate for the "masked" host).
Is there a way of accomplishing this, or should I try to think of something else?