fix(supervisor): launch hugo server with --noHTTPCache #344

Merged
dominik.polakovics merged 1 commit from afk/342 into main 2026-10-23 08:52:02 +02:00

Closes #342

What

hugo server sends Last-Modified and no Cache-Control, so a preview iframe recreated after leaving the View module (View → Edit → save → View) is served from the browser's disk cache and shows the page as it was before the save. The supervisor now passes --noHTTPCache to Hugo, which makes it send Cache-Control: no-store, no-cache, must-revalidate, max-age=0 and Pragma: no-cache, so every load revalidates.

  • internal/supervisor/supervisor.go: adds --noHTTPCache to the hugo server arguments in runOnce. It is passed always, in both loopback and --preview-base-url mode.
  • internal/supervisor/supervisor_test.go: TestHugoArgsFollowPublicURL now asserts the flag in all four cases (loopback and three public-URL cases).
  • docs/harness.md "Serving": lists the flag next to --buildDrafts and the bind. The README is unchanged. No scaffolded skill walks through Hugo's flags, so no skill changes either.

The client is unchanged: PreviewPane's "same URL means no reload" discipline (#241) stays as it is.

Verification

  • go test ./... passes (after make build creates web/dist).
  • Live check with the pinned Hugo 0.167.0: harness init a scratch site, then harness serve --site <dir> --preview-port 18313, then curl -sI http://127.0.0.1:18313/:
    HTTP/1.1 200 OK
    Cache-Control: no-store, no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    
    The headers also appear on 404 responses. This settles the issue's "assumption to check": the flag covers every page Hugo renders and serves.
  • Not done: the headless-Chromium View → Edit → View reproduction. With the headers above, the browser can no longer reuse the cached document without revalidating.

🤖 Generated with Claude Code

Closes #342 ## What `hugo server` sends `Last-Modified` and no `Cache-Control`, so a preview iframe recreated after leaving the View module (View → Edit → save → View) is served from the browser's disk cache and shows the page as it was before the save. The supervisor now passes `--noHTTPCache` to Hugo, which makes it send `Cache-Control: no-store, no-cache, must-revalidate, max-age=0` and `Pragma: no-cache`, so every load revalidates. - `internal/supervisor/supervisor.go`: adds `--noHTTPCache` to the `hugo server` arguments in `runOnce`. It is passed always, in both loopback and `--preview-base-url` mode. - `internal/supervisor/supervisor_test.go`: `TestHugoArgsFollowPublicURL` now asserts the flag in all four cases (loopback and three public-URL cases). - `docs/harness.md` "Serving": lists the flag next to `--buildDrafts` and the bind. The README is unchanged. No scaffolded skill walks through Hugo's flags, so no skill changes either. The client is unchanged: `PreviewPane`'s "same URL means no reload" discipline (#241) stays as it is. ## Verification - `go test ./...` passes (after `make build` creates `web/dist`). - Live check with the pinned Hugo 0.167.0: `harness init` a scratch site, then `harness serve --site <dir> --preview-port 18313`, then `curl -sI http://127.0.0.1:18313/`: ``` HTTP/1.1 200 OK Cache-Control: no-store, no-cache, must-revalidate, max-age=0 Pragma: no-cache ``` The headers also appear on 404 responses. This settles the issue's "assumption to check": the flag covers every page Hugo renders and serves. - Not done: the headless-Chromium View → Edit → View reproduction. With the headers above, the browser can no longer reuse the cached document without revalidating. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(supervisor): launch hugo server with --noHTTPCache
All checks were successful
ci / build-and-test (pull_request) Successful in 4m14s
ci / release (pull_request) Has been skipped
791611b723
hugo server answers pages with Last-Modified and no Cache-Control, so a
browser applies heuristic freshness: when the View module's preview
iframe is recreated after an element save, the page comes from the disk
cache and shows the content from before the save. --noHTTPCache makes
Hugo send Cache-Control: no-store, no-cache, must-revalidate, max-age=0
and Pragma: no-cache, so every load revalidates. It is passed in both
launch modes, loopback and --preview-base-url.

Closes #342

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

PASS. Signal: ci / build-and-test success (go vet, go test ./... with pinned Hugo 0.167.0, npm test). Title is Conventional Commits, body has Closes #342, diff is within the issue's Key interfaces (internal/supervisor/supervisor.go:246, supervisor_test.go:195, docs/harness.md:168). No skill or AGENTS.md names Hugo's flags, so none needs a change.

[autoland] verdict: pass PASS. Signal: ci / build-and-test success (go vet, go test ./... with pinned Hugo 0.167.0, npm test). Title is Conventional Commits, body has Closes #342, diff is within the issue's Key interfaces (internal/supervisor/supervisor.go:246, supervisor_test.go:195, docs/harness.md:168). No skill or AGENTS.md names Hugo's flags, so none needs a change.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/deckle!344
No description provided.