Skip to content

fix(nginx): serve index.html with no-cache (H1)#51

Merged
WolfTasks merged 1 commit into
mainfrom
worktree-hardening-h1
Jul 10, 2026
Merged

fix(nginx): serve index.html with no-cache (H1)#51
WolfTasks merged 1 commit into
mainfrom
worktree-hardening-h1

Conversation

@WolfTasks

Copy link
Copy Markdown
Owner

Small ops/frontend hardening from the 2026-07-07 backlog (H1), prepared as its own
spec+plan under docs/superpowers/.

Problem

frontend/nginx-spa.conf serves index.html with no Cache-Control. The
asset-cache regex deliberately doesn't match .html, so index.html is neither
immutable nor no-cache. A browser can therefore hold a stale index.html
(with old asset hashes) after a deploy until a manual hard-reload — exactly what
was seen after the v1.0.07 redeploy (2026-07-07).

Fix

Add a dedicated location = /index.html block setting Cache-Control: no-cache.
Because nginx add_header in a location replaces the server-level headers
(they aren't inherited when the child block has its own add_header), the block
re-declares all five security headers (X-Content-Type-Options, X-Frame-Options,
Referrer-Policy, Permissions-Policy, CSP) alongside the new Cache-Control.
Hashed assets keep public, immutable / 1-year. docker/nginx.conf (compose
proxy) needs no change.

Verification

No frontend test framework, so verified against the built config on nginx:alpine:

  • nginx -t → syntax OK.
  • curl -I / and /index.htmlCache-Control: no-cache and all five
    security headers (incl. CSP) present.
  • curl -I /assets/index-<hash>.js → still public, immutable + 1-year Expires,
    no no-cache.

Spec/plan: docs/superpowers/specs/2026-07-10-h1-nginx-index-nocache-design.md
and matching plans/ (on local main).

🤖 Generated with Claude Code

Add a dedicated location = /index.html block that sets Cache-Control:
no-cache and re-declares all five security headers (nginx add_header in a
location replaces server-level headers). Hashed assets stay immutable.
Browsers now always fetch fresh index.html with new asset hashes after a
deploy, removing the manual hard-reload workaround.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@WolfTasks WolfTasks merged commit 4ba7750 into main Jul 10, 2026
11 checks passed
@WolfTasks WolfTasks deleted the worktree-hardening-h1 branch July 10, 2026 21:33
WolfTasks pushed a commit that referenced this pull request Jul 10, 2026
H2+H3 merged via PR #50, H1 via PR #51 (both 2026-07-10, squash). All three
hardening items now on main; release still pending (last v1.0.09).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant