# Common middleware settings for docker containers

**URL:** <https://community.traefik.io/t/common-middleware-settings-for-docker-containers/6073>\
**Category:** Traefik v2\
**Tags:** middleware, docker\
**Created:** [May 15, 2020, 6:12pm UTC](https://community.traefik.io/t/common-middleware-settings-for-docker-containers/6073 "2020-05-15T18:12:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caevv](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@caevv](https://community.traefik.io/u/caevv)\
**Post date:** [May 15, 2020, 6:12pm UTC](https://community.traefik.io/t/common-middleware-settings-for-docker-containers/6073/1 "2020-05-15T18:12:50Z")

</div>

Hi all,

I'm trying to have a common set of settings on traefik.yml, but I get that the middleware does not exist. How can I get some middleware settings on my traefik.yml for all my docker services, each running on a different subdomain of my host?

Error:

```auto
time="2020-05-15T18:02:11Z" level=error msg="middleware \"services@file\" does not exist" entryPointName=websecure routerName=websecure-myservice@docker

```

traefik.yml

```auto
entryPoints:
  web:
    address: :80
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
  websecure:
    address: :443
    http:
      middlewares:
        - services@file # also tried without @file

http:
  services:
    myServices:
      loadBalancer:
        passHostHeader: true
  middlewares:
    services:
      headers:
        customResponseHeaders:
          X-Robots-Tag: "noindex,nofollow,nosnippet,noarchive,notranslate,noimageindex"
        SSLForceHost: true

providers:
  providersThrottleDuration: 2s
  docker:
    watch: true
    endpoint: unix:///var/run/docker.sock
    swarmModeRefreshSeconds: 15s

```

docker-compose file:

```auto
  myservice:
    image: myimage
    container_name: myservice
    hostname: myservice
    networks:
      - traefik_proxy
    labels:
      traefik.enable: "true"
      traefik.http.services.myservice.loadbalancer.server.port: 9000
      traefik.http.routers.myservice.rule: "Host(`myservice.${DOMAINNAME}`)"
      traefik.http.routers.myservice.entrypoints: "web,websecure"
      traefik.docker.network: traefik_proxy

```

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [May 15, 2020, 6:36pm UTC](https://community.traefik.io/t/common-middleware-settings-for-docker-containers/6073/2 "2020-05-15T18:36:28Z")

</div>

> [@caevv](#):
>
> but I get that the middleware does not exist

But it does! You can use [chain](https://docs.traefik.io/middlewares/chain/) to reuse a set of middlewares.

> [@caevv](#):
>
> Error:
> 
> ```auto
> time="2020-05-15T18:02:11Z" level=error msg="middleware \"services@file\" does not exist" entryPointName=websecure routerName=websecure-myservice@docker
> 
> ```

You have you dynamic and static config in the same file, you cannot do that. You will want to enable the file provider and the docker provider too.
