First time with Traefik... and fails!


I try to use traefik to fill my needs for one project, I'm making a PoC.

To be simple, I have a server whith :

  • A Rundeck runing on port 4440 (directly installed)
  • A Wireguard WebUI running on port 8080 (docker)

I want to bring up Traefik with a dashboard, locked with a basic auth, and I want to have another basic auth to access Wireguard WUI.

So, I make this docker-compose file :

version: '3.6'
    image: vx3r/wg-gen-web:latest
    container_name: wg-gen-web
    restart: unless-stopped
    - WG_CONF_DIR=/data
    - WG_INTERFACE_NAME=wg0.conf
    - /etc/wireguard:/data
    - "traefik.http.routers.wg-gen-web.entrypoints=http"
    - "traefik.enable=true"
    - "traefik.http.middlewares.wg-gen-web.basicauth.users=admin:$$apr1$$61HG58iz$$U9BVx0k/faOMv5xYm3/5d/"
    - "traefik.http.routers.wg-gen-web.rule=(Host(``) && PathPrefix(`/wg-ui`))"
    - ""
    - "traefik.http.middlewares.strip-wg-gen-web.stripprefix.prefixes=/wg-ui"
    - "traefik.http.routers.wg-gen-web.middlewares=strip-wg-gen-web"

    restart: always
    image: traefik:v2.0
    - "80:80"
    - /srv/traefik.toml:/etc/traefik/traefik.toml
    - /var/run/docker.sock:/var/run/docker.sock
    - /srv/services.toml:/etc/traefik/services.toml
    - "traefik.http.routers.api.rule=Host(``)"
    - "traefik.http.routers.api.service=api@internal"
    - "traefik.http.routers.api.entrypoints=http"
    - "traefik.http.routers.api.middlewares=auth"
    - "traefik.http.middlewares.auth.basicauth.users=admin:$$apr1$$61HG58iz$$U9BVx0k/faOMv5xYm3/5d/"

My traefik.toml :

  address = ":80"


  endpoint = "unix:///var/run/docker.sock"

  filename = "/etc/traefik/services.toml"

    rule = "Path(`/rundeck`)"
    service = "rundeck"

And, my services.toml :

          url = ""

Dashboard is OK with basic auth working. But none of other service works. For wg-gen-web, if I use "PathPrefix", I get a "Bad Gateway" response, if I use "Path", a 404 error.

If anyone can help me...

Thank you!

Routers and Services are both dynamic config, they both need to go into a dynamic config file which is loaded via provider.file in static config.

Routing with PathPrefix and StripPrefix often fails with apps, because they are not path-aware. They will respond with redirects and links that are not according to your setup. Use sub-domains instead. Locally you can place them in hosts file or your DSL router DNS config.

Here is a simple Traefik example configuration.

PS: Traefik v2.0 is really old, use v2.9.