# Please help Traefik newby with basic default config

**URL:** <https://community.traefik.io/t/please-help-traefik-newby-with-basic-default-config/12554>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [November 29, 2021, 4:15pm UTC](https://community.traefik.io/t/please-help-traefik-newby-with-basic-default-config/12554 "2021-11-29T16:15:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kolossi](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kolossi](https://community.traefik.io/u/kolossi)\
**Post date:** [November 29, 2021, 4:15pm UTC](https://community.traefik.io/t/please-help-traefik-newby-with-basic-default-config/12554/1 "2021-11-29T16:15:27Z")

</div>

Hi All,

2-day-old newbie to traefik, needing help with what istm is a basic first docker provider config.

I've tried searching through the docs, but just can't figure out how to do what I'm after.

I'd like to have docker containers like

- app1
- app2
- app3

And have these accessed through traefik via the urls

- `http://app.mydomain.com/app1`
- `http://app.mydomain.com/app2`
- `http://app.mydomain.com/app3`

However the apps themselves don't like these extra paths, so I'd like strip the prefix from the access paths so the apps don't see them.

If I access `http://app.mydomain.com/app2/foo` I'd like container `app2` to get the request `http://{container.ip.addr}}/foo`

As a repro, the config I do know partially works is having the following in my traefik `docker-compose.yml`:

```auto
version: "3"
services:
  traefik:
    image: "traefik:v2.5.4"
    command:
      - --entrypoints.web.address=:80
      - --providers.docker=true
      - --api
      - --api.insecure=true
      - --api.dashboard=true
      - --providers.file.directory=/etc/traefik/dynamic
      - --providers.docker.defaultRule=Host(`app.mydomain.com`) && PathPrefix(`/{{ index .Labels "com.docker.compose.service" }}`)
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  app1:
    image: containous/whoami:v1.3.0
  app2:
    image: containous/whoami:v1.3.0
  app3:
    image: containous/whoami:v1.3.0

```

Having added `127.0.0.1 app.mydomain.com` to `\etc\hosts`, doing a curl to `http://app.mydomain.com/app{1,2,3}/foo` this routes to the correct service, but the request path they receive is `/app1/foo`, `/app2/foo`, `/app3/foo` whereas I'd like them all to get `/foo`.

I feel like I'd like to be able to add the following to the command line params in the docker-compose:

```auto
--providers.docker.middleware.default-stripprefix.stripprefix.prefixes=`/{{ index .Labels "com.docker.compose.service" }}`

```

but it doesnt work (error: `command traefik error: failed to decode configuration from flags: field not found, node: middleware`)

I can't find any docs that indicate what the correct commandline param(s) might be.

I'm thinking it might need to be in a dynamic config file (I've seen that too messing with tls config, but want to keep all that out of the repro at this stage!) but again can't seem to find what the correct config would be for a default ~~rule~~ middleware.

I can find lots of refs (and get it working) where I have to specify it in labels on each container, but I'd prefer just to default this out with one-time entries in the traefik config itself.

I've been bashing my head against this for 2 days now. I've tried searching the docs site, this community and the googleverse but without luck. It seems like such a "101" config to me! 🙂

Please would someone help me not only solve my issue but teach me how I could have found the solution myself in the docs site.

TIA

---

<div class="post-metadata">

**Author:** ![kolossi](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kolossi](https://community.traefik.io/u/kolossi)\
**Post date:** [December 4, 2021, 2:48pm UTC](https://community.traefik.io/t/please-help-traefik-newby-with-basic-default-config/12554/2 "2021-12-04T14:48:00Z")

</div>

Since doing a couple of minor typo edits resulted in the forum system here marking this post as spam(?!?! ikr!), I reposted at [StackOverflow](https://stackoverflow.com/q/70158137/2738122) and ultimately provided the answer there myself after further research.

**TL;DR** , : I hadn't grasped the difference between Traefik's confusingly-named "static" and "dynamic" configuration types.

In the link above I post a solution consisting of:

- `docker-compose.yml`
- (static config) `traefik.yml`
- (dynamic config) `dynamic.yml`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [December 9, 2021, 6:53am UTC](https://community.traefik.io/t/please-help-traefik-newby-with-basic-default-config/12554/4 "2021-12-09T06:53:24Z")

</div>

Closed on December 9, 2021, 6:53am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
