brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: HSTS Sub-domains in Nginx Proxy Manager is a security header that is hard to undo

Security
~/tips/tip-security-npm-hsts-subdomains

Strict-Transport-Security: max-age=63072000; preload

Explains what the HSTS switches in NPM send and why they stick for two years.

On the SSL tab of a proxy host, NPM has two switches: HSTS Enabled and HSTS Sub-domains. They look harmless, but browsers remember what they send for a long time.

The NPM templates show the exact header. With only HSTS Enabled you get:

Strict-Transport-Security: max-age=63072000; preload

With Sub-domains switched on as well:

Strict-Transport-Security: max-age=63072000;includeSubDomains; preload

63072000 seconds is two years. A browser that has seen this header will refuse plain HTTP to that host for that whole period, and with includeSubDomains also to every name below it. NPM only sends it when Force SSL is on, which makes sense.

For a public site that is always on HTTPS, I think HSTS is a good idea. The trouble starts when you set Sub-domains on example.com while some device on printer.example.com or an old NAS still only speaks HTTP. Every browser that visited the main site will refuse to open those, and there is no switch on your side to undo that for them.

Check the result with curl -sI https://example.com | grep -i strict. If you ever need to back out, send a header with max-age=0 for a while, so browsers that come back forget the old rule. The preload token only matters if you submit the domain to the browser preload list yourself, but it’s one more reason to be sure.

Further reading: Nginx Proxy Manager HSTS template, MDN: Strict-Transport-Security

Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link