Router debugging - how? and n00b query

Edit - Update! I wanted PathPrefix, not Path in the router... That's fixed the problem, but the real question here is how can I debug Traefik without trial and error?

Hi - tested on traefik docker image v3.3.3

New to traefik - I would like to know how to debug/trace a request through the routers and services and see how it's being processed and more importantly, why it's not being processed the way I expect.

So far I have:

  • Enabled Debug logging (lots of startup stuff, nothing on requests)
  • Enabled access logging (the usual single log per request)
  • Enabled tracing to Jaeger - can see traces, but no useful information in them.

Below is a trivial case where despite much googling, it's not working as expected.
I expect someone can see immediately what's wrong - but for me, this is a useful exercise is
"how can I get Traefik to tell me how this is being processed in detail?"

  • because I'm sure to run into more complex problems in the future when I use this to front 100 odd web services.

Is there a way to get debug level logging on request-processing router by router (sort of like the Apache rewrite log level of detail)?

Static config:

log:
  level: DEBUG
  filePath: /volumes/logs/_default.log
  format: json

accesslog:
  filePath: /volumes/logs/_access.log
  format: json

entryPoints:
  web:
    address: :80

defaultEntryPoints:
  - web

providers:
  file:
    directory: "/etc/traefik/dynamic/"
    watch: true

and /etc/traefik/dynamic/sites.yml:

http:
  routers:
    r_nginx1:
      rule: "Path(`/`)"
      service: s_nginx1:

  services:
    s_nginx1:
      loadBalancer:
        servers:
          - url: http://whoami:80

docker compose:

services:
  whoami:
    container_name: whoami
    # A container that exposes an API to show its IP address
    image: traefik/whoami
    labels:
      - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
    ports: 
      - 8000:80

  traefik:
    image: "traefik:v3.3"
    container_name: "traefik"
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - ../volumes/traefik/config/static/traefik.yml:/etc/traefik/traefik.yml:ro
      - ../volumes/traefik/config/dynamic/:/etc/traefik/dynamic:ro
      - ../volumes/logs:/volumes/logs

http://whoami:80 works from within the traefik container and is the traefik/whoami image.

curl http://localhost:80/ to traefik gets a 404.

Many thanks - :slight_smile: