traefik

Traefik - Routers and services not registering


I have the following Traefik setup:

Here's my docker-compose.yml for Traefik:


  traefik:
    image: traefik:v3.3
    container_name: syncly_traefik
    ports:
        - "80:80"
        - "443:443"
        - "8080:8080"
    networks:
      - syncly_network
    volumes:
      - ./traefik/traefik.toml:/etc/traefik/traefik.toml
      - ./.logs:/var/log/traefik.log
      - ./traefik/certs:/certs

And my traefik.toml:

# traefik.toml

[api]
  dashboard = true
  insecure = true

[entryPoints]
  [entryPoints.http]
    address = ":80"

[log]
level = "DEBUG"

[accessLog]
  addInternals = true

[http.routers]
  [http.routers.fastapi]
    service = "fastapi"
    rule = "PathPrefix(`/syncly`)"
    entryPoints = ["http"]

  [http.routers.traefik]
    rule = "PathPrefix(`/traefik`)"
    service = "api@internal"
    entryPoints = ["http"]

[http.services]
  [http.services.fastapi.loadBalancer]
    [[http.services.fastapi.loadBalancer.servers]]
      url = "http://syncly_web:8000"

I can without problems reach syncly_web from the traefik container: logs

However, entering localhost/syncly leads me to nowhere. In addition, the service is not availalbe in the dashboard: screenshot of dashboard

It doesn't appear at Errors tab either. The route also doesnt appear at HTTP Routers, nor does the oen with PathPrefix('/traefik')


Solution

  • Traefik does proxy/forward requests. A "redirect" tells the HTTP client to go to a different address.

    http is Traefik dynamic config. Place it in a separate config file and load it in static config via providers.file (doc).

    Traefik dashboard is reachable at /dashboard/ and requires /api, it will not respond to /traefik (doc), unless explicitly configured so, only available in the latest (or next?) version.