Traefik: add security headers

Add the following to your traefik.yml http: middlewares: secure-headers: headers: # Enable HTTP Strict Transport Security (HSTS) stsSeconds: 31536000 stsPreload: true # X-Content-Type-Options header contentTypeNosniff: true # Prevent browser from running any kind of active content inside the page. frameDeny: t…

Traefik: redirect www to non-www

Add the following to your traefik.yml http: middlewares: www-redirect: redirectregex: regex: ^(?:https://)?(?:www\.)?(.+) replacement: https://${1} permanent: true Now you can just add the following label to your docker container: traefik.http.routers.REPLACE-THIS.middlewares: "www-redirect@file"…