fix(ui): stale chunk 404 after redeployment — missing Cache-Control on index.html

Open Beginner friendly
#473 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
nginx, vite
Domain
devops, frontend

Research direction

Start with nginx.conf and inspect how the SPA entry point is served alongside hashed assets. Add the specified no-cache headers for index.html, then verify the response headers after deployment and confirm that a redeployed UI no longer serves a cached entry point referencing missing chunks.

Written by the indexing model from the issue text.

Description

agent:github-maintain maintain:triaged P2-medium P3-low

Problem

After redeploying the goclaw-ui container, users with a cached index.html get:

[ErrorBoundary] TypeError: Failed to fetch dynamically imported module:
https://hq.humanscale.app/assets/login-page-DrRJxksg.js

Root cause: Nginx serves index.html without Cache-Control headers, so browsers may cache it. After a rebuild, Vite generates new chunk hashes — the old index.html references chunks that no longer exist on the server.

Current Mitigations

  • lazyWithRetry() in lib/lazy-with-retry.ts retries once then force-reloads with a sessionStorage guard
  • Hashed assets in /assets/ are correctly served with Cache-Control: public, immutable

Missing Fix

nginx.conf needs explicit no-cache headers for index.html to prevent browsers from caching the SPA entry point:

location = /index.html {
    add_header Cache-Control "no-cache, no-store, must-revalidate";
    add_header Pragma "no-cache";
    add_header Expires "0";
}

Impact

  • Users see a broken page after deploy until they hard-refresh
  • lazyWithRetry auto-reload helps but only fires once per session
Dominant language
Go
Stars
3.6k
Forks
1.1k
Avg merge
3d 4h
Merged PRs (30d)
24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextlevelbuilder/goclaw

All issues in nextlevelbuilder/goclaw

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.