# Setting HSTS headers

**URL:** <https://community.traefik.io/t/setting-hsts-headers/3794>\
**Category:** Traefik v2\
**Tags:** file, docker, middleware, docker-swarm\
**Created:** [January 10, 2020, 11:11pm UTC](https://community.traefik.io/t/setting-hsts-headers/3794 "2020-01-10T23:11:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkl0rd](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@darkl0rd](https://community.traefik.io/u/darkl0rd)\
**Post date:** [January 10, 2020, 11:11pm UTC](https://community.traefik.io/t/setting-hsts-headers/3794/1 "2020-01-10T23:11:32Z")

</div>

Hi,

I have setup my middleware using the file provider as such:

```auto
http:
  middlewares:
    redirect:
      redirectScheme:
        scheme: https

    hsts:
      headers:
        frameDeny: true
        contentTypeNosniff: true
        browserXssFilter: true
        forceSTSHeader: true
        sslRedirect: true
        stsPreload: true
        stsSeconds: 315360000
        stsIncludeSubdomains: true

    secure:
      chain:
        middlewares:
          - redirect
          - hsts

```

And in my docker-compose.yml I am setting the following labels:

```auto
      - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
      - "traefik.http.routers.http-catchall.entrypoints=http"
      - "traefik.http.routers.http-catchall.middlewares=secure@file"

```

I can see in the Traefik dashboard that the router is using the middleware. The middleware configuration looks correct - yet when looking in the Chrome network console, I do not see the respective headers.

I have also tried defining the middleware through docker labels, to rule out that it's not because of mixing docker + file providers. The result is the same.

My goal here is:

1. Global HTTP -\> HTTPS redirect.
2. Global definition of standard headers.

---

<div class="post-metadata">

**Author:** ![pascalandy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/pascalandy/32/289_2.png) [@pascalandy](https://community.traefik.io/u/pascalandy)\
**Post date:** [January 17, 2020, 8:02pm UTC](https://community.traefik.io/t/setting-hsts-headers/3794/2 "2020-01-17T20:02:55Z")

</div>

Seems related to what we can observe here:

> <https://github.com/containous/traefik/issues/5890>
>
> Do you want to request a feature or report a bug?
> Bug
> What did you do?
> Except to see custom headers when the headers...
