@@ -65,9 +65,15 @@ services:
6565 - " traefik.http.routers.https-webapp.entryPoints=https"
6666 # Keep buffering off the /api router because it would hold SSE responses until they close.
6767 # Define this middleware with its router so the app stack does not depend on the proxy stack.
68+ # HSTS rides on the router, not on the entrypoint: an entrypoint middleware exists only when
69+ # this deployment's edge is the proxy stack, and behind someone else's proxy the header
70+ # would silently go missing. The other security headers are set by the responses
71+ # themselves, so this is the one that has nowhere else to come from.
72+ - traefik.http.middlewares.app-hsts.headers.stsSeconds=2592000
73+ - traefik.http.middlewares.app-hsts.headers.stsIncludeSubdomains=true
6874 - traefik.http.middlewares.webapp-body-limit.buffering.maxRequestBodyBytes=26214400
6975 - traefik.http.middlewares.webapp-body-limit.buffering.memRequestBodyBytes=1048576
70- - " traefik.http.routers.https-webapp.middlewares=webapp-body-limit"
76+ - " traefik.http.routers.https-webapp.middlewares=app-hsts, webapp-body-limit"
7177 - " traefik.http.routers.https-webapp.rule=(${APP_HOST_MATCH:-Host(`${APP_HOSTNAME}`)}) && PathPrefix(`/`)"
7278 - " traefik.http.routers.https-webapp.service=https-webapp"
7379 - " traefik.http.routers.https-webapp.tls.certresolver=letsencrypt"
@@ -85,7 +91,7 @@ services:
8591 - " traefik.http.middlewares.canonical-host.redirectregex.replacement=https://${APP_HOSTNAME}/$${1}"
8692 - " traefik.http.middlewares.canonical-host.redirectregex.permanent=true"
8793 - " traefik.http.routers.https-canonical.entryPoints=https"
88- - " traefik.http.routers.https-canonical.middlewares=canonical-host"
94+ - " traefik.http.routers.https-canonical.middlewares=app-hsts, canonical-host"
8995 - " traefik.http.routers.https-canonical.rule=(${APP_HOST_MATCH:-Host(`${APP_HOSTNAME}`)}) && !Host(`${APP_HOSTNAME}`) && PathPrefix(`/`)"
9096 - " traefik.http.routers.https-canonical.service=https-webapp"
9197 # No certresolver here on purpose: ACME derives a router's domains from its rule and does not
@@ -312,7 +318,7 @@ services:
312318 - " traefik.http.routers.http-application-server.rule=(${APP_HOST_MATCH:-Host(`${APP_HOSTNAME}`)}) && PathPrefix(`/api`)"
313319 - " traefik.http.routers.http-application-server.service=http-application-server"
314320 - " traefik.http.routers.https-application-server.entryPoints=https"
315- - " traefik.http.routers.https-application-server.middlewares=edge-api-rate-limit,https-application-server-stripprefix"
321+ - " traefik.http.routers.https-application-server.middlewares=app-hsts, edge-api-rate-limit,https-application-server-stripprefix"
316322 - " traefik.http.routers.https-application-server.rule=(${APP_HOST_MATCH:-Host(`${APP_HOSTNAME}`)}) && PathPrefix(`/api`)"
317323 - " traefik.http.routers.https-application-server.tls.certresolver=letsencrypt"
318324 - " traefik.http.routers.https-application-server.tls=true"
0 commit comments