docker.defaultRoute creates both HTTP and HTTPS entrypoints despite no valid HTTPS certificate

I created an issue on GitHub but a bot has decided I should post here instead: https://github.com/containous/traefik/issues/6299

What did you do?

Traefik automatically creates routes for docker containers when no routing rule is applied. These routes are then applied to both :80 and :443 entrypoints despite the fact that the route has no valid TLS certificate.

What did you expect to see?

For a default rule the :443 entrypoint should only be created automatically if there is a valid TLS certificate.

There are a few different ways to solve this:

  1. Let the user specify a default cert resolver in traefik.yml/traefik.toml that is applied to all default routes.:
providers:
  docker:
    defaultCertResolver: le
  1. Give the user control over which entrypoints are used for the default routes:
providers:
  docker:
    defaultEntryPoints: web,websecure
... or ...
    defaultEntryPoints: web