basicAuth is skipped when also using headers

Dear all,
I have the following in my dynamic.yml:

  middlewares:
    dashboard-auth:
      basicAuth:
        users:
          - "administrator:*************"
    secure-headers:
      headers:
        frameDeny: true

and the following in my docker-compose.yml:

      - "traefik.http.routers.dashboardRouter.middlewares=dashboard-auth@file"
      - "traefik.http.routers.dashboardRouter.middlewares=secure-headers@file"

I noticed that if I have both lines above in docker-compose.yml, then the headers are applied correctly, but dashboard-auth doesn't get executed, i.e. no user name/password are asked to enter the dashboard. If I remove the secure-headers line from docker-compose.yml, the authentication works normally.
I guess it is because the secure-headers middleware overwrites the headers added by dashboard-auth. What is the proper way to chain these middlewares?

Thanks in advance for any pointers in the right direction!

Use a comma between the middlewares.

…middlewares=a,b

Spot on, thank you!

I changed the lines to one like this:

- "traefik.http.routers.dashboardRouter.middlewares=secure-headers@file,dashboard-auth@file"

And all is good!
Thank you again!!!

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