Dashboard Returns "404 page not found"

Hello,

Thanks in advance for the help!

I'm trying to access my dashboard at mydomain.xyz/traefik

The path is corrected to https://mydomain.xyz/traefik and I receive a "404 page not found error"

docker-compose


  traefik:
    image: traefik:v2.0
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${PATH_TO_DATA}traefik/data/traefik.yml:/traefik.yml:ro
      - ${PATH_TO_DATA}traefik/data/acme.json:/acme.json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=PathPrefix(`/traefik`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=${USER_PASS}"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=PathPrefix(`/traefik`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=http"
      - "traefik.http.routers.traefik-secure.service=api@traefik"

traefik.yml

api:
  dashboard: true

entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"

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

certificatesResolvers:
  http:
    acme:
      email: #######
      storage: acme.json
      httpChallenge:
        entryPoint: http

Any help would be greatly appreciated.

Thanks!

hi, were you able to get this working? I also want to access the traefik dashboard as subdirectory and not subdomain. Like, [APP].[DOMAIN]/traefik and not [traefik].[APP].[DOMAIN]

Sort of. Hope this is helpful:

docker-compose

  traefik:
    hostname: traefik
    image: traefik:v1.7.18
    container_name: traefik
    restart: always
    domainname: ${DOMAIN_NAME}
    networks:
      - default
      - traefik_proxy
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    environment:
      - CF_API_EMAIL=${API_EMAIL}
      - CF_API_KEY=${API_KEY}
    labels:
      - "traefik.enable=true"
      - "traefik.backend=traefik"
     # - "traefik.frontend.rule=Host:traefik.${DOMAIN_NAME}"
      - "traefik.frontend.rule=Host:${DOMAIN_NAME}; PathPrefixStrip: /traefik"
      - "traefik.port=8080"
      - "traefik.docker.network=traefik_proxy"
      - "traefik.frontend.headers.SSLRedirect=true"
      - "traefik.frontend.headers.STSSeconds=315360000"
      - "traefik.frontend.headers.browserXSSFilter=true"
      - "traefik.frontend.headers.contentTypeNosniff=true"
      - "traefik.frontend.headers.forceSTSHeader=true"
      - "traefik.frontend.headers.SSLHost=${DOMAIN_NAME}"
      - "traefik.frontend.headers.STSIncludeSubdomains=true"
      - "traefik.frontend.headers.STSPreload=true"
      - "traefik.frontend.headers.frameDeny=false"
      - "traefik.frontend.auth.basic.users=${USER_PASS}"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ${PATH_TO_DATA}traefik:/etc/traefik
      - ${PATH_TO_DATA}shared:/shared

traefik.toml

logLevel = "WARN" #DEBUG, INFO, WARN, ERROR, FATAL, PANIC
defaultEntryPoints = ["http", "https"]

# WEB interface of Traefik - it will show web page with overview of frontend and backend configurations
[api]
  entryPoint = "traefik"
  dashboard = true
  address = ":8080"

# Force HTTPS
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

[file]
  watch = true
  filename = "/etc/traefik/rules.toml"

# Let's encrypt configuration
[acme]
email = "####@####.###"
storage="/etc/traefik/acme/acme.json"
entryPoint = "https"
acmeLogging=true
onDemand = true #create certificate when container is created (Default: false
onHostRule = true
  # Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge
  [acme.httpChallenge]
  entryPoint = "http"

# Connection to docker host system (docker.sock)
[docker]
  endpoint = "unix:///var/run/docker.sock"
  domain = "xyz.tld"
  watch = true
  # This will hide all docker containers that don't have explicitly
  # set label to "enable"
  exposedbydefault = false

I have similar issue with grafana7 and traefikv2 , see in the picture 404 page not found , which appear randomly when dashboard refresh. Initially I though that was a problem with traefik v2, since I have grafana v6.xx with traefik v1.7 running without that kind of problem.

But now I tried grafana 7 with traefik v1.7 and I got the same issue, so looks like the problem is grafana 7.
I have to try Grafana 6 with traefik v2 to make sure the problem is with grafana7 Not with traefik v2.

I think I found the cause of my problem with traefik and grafana, nothing to do with traefik..
it was grafana container that was restarting every 15 to 20 seconds..

1 Like