Can't access Traefik Dashboard

Hello,
I am new to Traefik and I have been trying to use it to set up a reverse proxy for an academic project.
The problem is I keep running into a "404 not found" and can't even access the dashboard.

Here is the Traefik section in my docker-compose.yml file:

reverse:
    image: traefik:v2.0
    ports:
      - "443:443"
      - "8080:8080"
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./letsencrypt:/letsencrypt
    command:
      - "--api=true"
      - "--api.dashboard=true"
      - " --api.insecure=true" 
      - "--api.debug=true"
      - "--providers.docker=true"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.dashboard.address=:8080"
      - "--certificatesresolvers.mydnschallenge.acme.dnschallenge=true"
      - "--certificatesresolvers.mydnschallenge.acme.dnschallenge.provider=cloudflare"
      - "--certificatesresolvers.mydnschallenge.acme.email=email@example.com"
      - "--certificatesresolvers.mydnschallenge.acme.storage=/letsencrypt/acme.json"
      - "--log.level=DEBUG"
    environment:
      CF_API_EMAIL: $CF_API_EMAIL
      CF_API_KEY: $CF_API_KEY
    labels:
      - "traefik.http.routers.api.rule=Host(`example.com`)"
      - "traefik.http.routers.api.entrypoints=dashboard"
      - "traefik.http.routers.api.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      - "traefik.http.routers.api.service=api@internal"

I am performing a DNS Challenge that is succeeding, so I don't think that's the problem.
I followed a tutorial that puts all the labels and commands into the docker compose and therefore have no Traefik.toml file

Is it possible that the problem lies there?

Cheers

Hello,

you cannot put several labels traefik.http.routers.api.rule

    labels:
      - "traefik.http.routers.api.rule=Host(`example.com`)"
      # or - "traefik.http.routers.api.rule=Host(`example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      - "traefik.http.routers.api.entrypoints=dashboard"
      - "traefik.http.routers.api.service=api@internal"

https://docs.traefik.io/v2.0/operations/dashboard/#secure-mode

Hello,

Thank you for your reply. That doesn't seem to be the problem.
The 404 error persist whether I try to access via the domain or via the IP

You have to remove " --api.insecure=true"

Recommend read:

Thank you so much for your answer. After reading what you recommended I managed to access the dashboard at the url: example.com:8080/dashboard !
I still needed to keep the --api.insecure to access it and changed the port to my dashboard entrypoint to 80 instead of 8080.
Now I still can't access the main service which runs on port 443 with a dns challenge resolver even though I see it running successfully on the dashboard. Probably a misconfiguration by me.

Thanks again !