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:
parent
c0a5e3ceeb
commit
bff082652a
5 changed files with 80 additions and 5 deletions
|
|
@ -60,15 +60,16 @@ const app = new Hono();
|
|||
app.use("*", logger());
|
||||
|
||||
/* Headers for every response. Referrer kept to the origin (YouTube
|
||||
embeds refuse to play without one); HSTS without includeSubDomains
|
||||
so a plain-http dev subdomain keeps working. No CSP yet: pages carry
|
||||
an inline window.__NGU_SITE__ script and YouTube, Facebook and Maps
|
||||
iframes, so one needs trying in Report-Only first. */
|
||||
embeds refuse to play without one). No HSTS here: nginx sends it on
|
||||
everything, including the files it serves from disk
|
||||
(docs/security-headers.md). No CSP yet: pages carry an inline
|
||||
window.__NGU_SITE__ script and YouTube, Facebook and Maps iframes,
|
||||
so one needs trying in Report-Only first. */
|
||||
app.use(
|
||||
"*",
|
||||
secureHeaders({
|
||||
referrerPolicy: "strict-origin-when-cross-origin",
|
||||
strictTransportSecurity: "max-age=31536000",
|
||||
strictTransportSecurity: false,
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue