HTTP AND HTTPS Can not work together with same route

Hello,
Thanks for your team work on this great project. I'd like to test some basic features of Traefik 2.0
Unfortunately,I found out that some of the basic features can work well on Traefik1.7, But not Traefik 2.0.

  1. Such as Globle HTTP TO HTTPS
  2. Can not generate a Globle Wildcard certificate, i have to generate a specific domain certificate on specific service.
  3. Htttp and https cannot work together on same service.

I used Traefik 2.0 with Docker-Swarm environment, Below is How i started Traefik-v2:

docker service create \
    --name traefik-v2 \
    --mode global \
    --network docker-proxy \
    --network web \
    --publish mode=host,target=80,published=80,protocol=tcp \
    --publish mode=host,target=443,published=443,protocol=tcp \
    --publish mode=host,target=8080,published=8080,protocol=tcp \
    --env 'ALICLOUD_REGION_ID=xxxxxx' \
    --env 'ALICLOUD_ACCESS_KEY=this is my secret' \
    --env 'ALICLOUD_SECRET_KEY=this is my super secret' \
    --mount type=bind,source=/usr/share/zoneinfo,destination=/usr/share/zoneinfo,ro=1 \
    --mount type=volume,source=traefik-v2,destination=/docker-volume \
    traefik:v2.0 \
    --providers.docker=true \
    --providers.docker.endpoint="tcp://docker-proxy:2375" \
    --providers.docker.swarmMode=true \
    --providers.docker.swarmModeRefreshSeconds=10s \
    --providers.docker.exposedByDefault=false \
    --entryPoints.web.address=:80 \
    --entryPoints.web-secure.address=:443 \
    --log=true \
    --log.level=INFO \
    --accesslog=true \
    --accesslog.bufferingsize=100 \
    --api.insecure=true \
    --certificatesresolvers.mydnschallenge.acme.dnschallenge=true \
    --certificatesresolvers.mydnschallenge.acme.dnschallenge.provider=alidns \
    --certificatesresolvers.mydnschallenge.acme.email=myemail@email.com \
    --certificatesresolvers.mydnschallenge.acme.storage=/docker-volume/acme.json \
    --certificatesresolvers.mydnschallenge.acme.dnschallenge.delaybeforecheck=10s \
    --certificatesresolvers.mydnschallenge.acme.dnschallenge.resolvers=114.114.114.114:53,8.8.8.8:5

In addition, This is How my docker service started: (I copy it from your document)

docker service create \
    --name whoami \
    --mode global \
    --network web \
    --label 'traefik.enable=true' \
    --label 'traefik.docker.network=web' \
    --label 'traefik.http.routers.whoami.rule=Host(`whoami.mydomain.com`)' \
    --label 'traefik.http.services.whoami.loadbalancer.server.port=80' \
    --label 'traefik.http.routers.whoami.tls.certresolver=mydnschallenge' \
    containous/whoami:latest

What's the problem?

If my server configured certresolver, It will olny work with HTTPS.

When i try to access my website with http://whoami.mydomain.com, I got 404 page not found.

Hello,

Because the TLS is not the router and not on the entry point, you have to create 2 routers.

I recommend to read:

1 Like

Thanks a lot. And Sorry for my carelessness, I didn't read the that. I'll test it and post my result later.

It works now. Thanks.