Traefik returns me a 404 with HTTPS

Hello everyone !

I am discovering Traefik and I am currently testing it. I use the documentation for this. but I am faced with a small problem.

I'm using a dedicated server that has Debian 11 installed and docker only.

My issue is the following :

With the CLI configuration everything works fine. I can access whoami.example.com with no problem.

But when I want to use a configuration file (traefik.yml) the address whoami.example.com returns me a 404 not found.

This works ->
(found here: Traefik Docker HTTP Challenge Documentation - Traefik)

docker-compose.yml
version: "3.3"

services:

  traefik:
    image: "traefik:v2.6"
    container_name: "traefik"
    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
      #- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesresolvers.myresolver.acme.email=postmaster@example.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.example.com`)"
      - "traefik.http.routers.whoami.entrypoints=websecure"
      - "traefik.http.routers.whoami.tls.certresolver=myresolver"

However, this does not work ->

docker-compose.yml
version: "3.3"

services:

  traefik:
    image: "traefik:v2.6"
    container_name: "traefik"
    restart: unless-stopped
    ports:
      # The HTTP port
      - "80:80"
      # The Web UI (enabled by --api.insecure=true)
      - "8080:8080"
      - "443:443"
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/home/my-user/apps/traefik/traefik.yml:/traefik.yml"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  whoami:
    image: "traefik/whoami"
    container_name: "simple-service"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.example.com`)"
      - "traefik.http.routers.whoami.entrypoints=websecure"
      - "traefik.http.routers.whoami.tls.certresolver=myresolver"
traefik.yml
api:
  insecure: true

prodivers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false

entryPoints:
  web:
    address: ":80"

  websecure:
    address: ":443"    

certificatesResolvers:
  myresolver:
    acme:
      email: postmaster@example.com
      storage: /letsencrypt/acme.json
      httpChallenge:
        # used during the challenge
        entryPoint: web

I don't understand what's wrong with my setup.
I think I need help figuring out what I did wrong.

Thank you

Hello @Crazyweedz,

You made a typo there:

It should be providers.

With this typo fixed like that, it should work as intended :smiley:

Thank you @tommoulard !

It works perfectly now. I don't understand how I missed such a silly mistake. :man_facepalming:t2: :sweat_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.