Send HSTS from nginx, not the API

nginx serves /assets, /uploads and the fallback index.html itself, so
the API's HSTS header never reached them. nginx now sends it on
everything and the API stops, so proxied pages don't get it twice.
docs/security-headers.md says who sends which header and what nginx
must pass (Host, X-Forwarded-For) for the CSRF check and rate limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:20:53 -05:00
parent c0a5e3ceeb
commit bff082652a
5 changed files with 80 additions and 5 deletions

View file

@ -72,6 +72,9 @@ which git ignores). The API serves `/uploads/` itself, and Vite proxies
add_header X-Content-Type-Options nosniff;
# An uploaded SVG opened on its own can't run script.
add_header Content-Security-Policy "default-src 'none'; style-src 'unsafe-inline'; sandbox";
# add_header here replaces the server-level HSTS; say it again
# (docs/security-headers.md).
add_header Strict-Transport-Security "max-age=31536000" always;
}
```