# Traefik - docker - consul catalog: default middlewares is not working

**URL:** <https://community.traefik.io/t/traefik-docker-consul-catalog-default-middlewares-is-not-working/10065>\
**Category:** Traefik v2\
**Tags:** docker, consul-catalog, middleware\
**Created:** [March 15, 2021, 6:22pm UTC](https://community.traefik.io/t/traefik-docker-consul-catalog-default-middlewares-is-not-working/10065 "2021-03-15T18:22:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonphung90](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/sonphung90/32/3546_2.png) [@sonphung90](https://community.traefik.io/u/sonphung90)\
**Post date:** [March 15, 2021, 6:22pm UTC](https://community.traefik.io/t/traefik-docker-consul-catalog-default-middlewares-is-not-working/10065/1 "2021-03-15T18:22:41Z")

</div>

- I have two services: service-a:8080, service-b:8081
- When i call the url: [http://localhost/services/service-a/api/ping](http://localhost/services/service-a/api/ping) -\> not found
- Real api: [http://service-a:8080/api/ping](http://service-a:8080/api/ping)

## docker-compose.yml

```auto
version: '2'
services:
  consul:
    extends:
      file: consul.yml
      service: consul
  traefik:
    extends:
      file: traefik.yml
      service: traefik

```

## consul.yml

```auto
version: "2"
services:
  consul:
    image: consul:1.9.4
    ports:
      - 8300:8300
      - 8500:8500
      - 8600:8600
    command: consul agent -dev -ui -client 0.0.0.0
    labels:
      - traefik.enable=true
      - "traefik.http.routers.my-router.rule=Host(`localhost`) && PathPrefix(`/services/`)"
      - "traefik.http.middlewares.test-stripprefixregex.stripprefixregex.regex=/services/[a-z]+/"
      - "traefik.http.routers.my-router.middlewares=test-stripprefixregex"

```

## trafik.yml

```auto
version: "2"
services:
  traefik:
    image: traefik:v2.4
    ports:
      - 80:80
      - 28080:8080
    volumes:
      - ./traefik/traefik.yml:/etc/traefik/traefik.yml
      - /var/run/docker.sock:/var/run/docker.sock

```

## ./traefik/traefik.yml

```auto
log:
  level: DEBUG

api:
  insecure: true

providers:
  docker:
    exposedByDefault: false
  consulCatalog:
    exposedByDefault: true
    prefix: traefik
    defaultRule: "Host(`localhost`) && PathPrefix(`/services/{{ normalize .Name }}`)"
    endpoint:
      address: "consul:8500"

```

---

<div class="post-metadata">

**Author:** ![sonphung90](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/sonphung90/32/3546_2.png) [@sonphung90](https://community.traefik.io/u/sonphung90)\
**Post date:** [March 18, 2021, 8:12am UTC](https://community.traefik.io/t/traefik-docker-consul-catalog-default-middlewares-is-not-working/10065/2 "2021-03-18T08:12:44Z")

</div>

any one can help me resolve this?

---

<div class="post-metadata">

**Author:** ![sonphung90](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/sonphung90/32/3546_2.png) [@sonphung90](https://community.traefik.io/u/sonphung90)\
**Post date:** [March 24, 2021, 3:34am UTC](https://community.traefik.io/t/traefik-docker-consul-catalog-default-middlewares-is-not-working/10065/3 "2021-03-24T03:34:36Z")

</div>

any one can help me resolve this?
