Web image serves index.html without Cache-Control and answers missing assets with index.html, so the app loads blank after an upgrade
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 79/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, typescript
Research direction
Start with apps/web/Caddyfile and the reproduction steps in the issue; they identify the cache-header and missing-asset behaviors to verify. Build and run the web image with docker compose up -d web caddy, then use the stated curl -I checks for / and a nonexistent /assets/ path. Done when the app entry point is revalidated and missing assets return 404; verify hashed assets retain long-lived immutable caching if implementing the suggested configuration.
Written by the indexing model from the issue text.
Description
After an upgrade, the web app can load a blank page for returning users. The web image's Caddy serves index.html with Last-Modified and ETag but no Cache-Control. Browsers therefore cache it heuristically: RFC 9111 §4.2.2 allows a response to be treated as fresh for a fraction of its age, typically 10% of the time since Last-Modified. index.html is rewritten by import-meta-env when the container starts, so a web container that has been running for 30 days hands out an index.html that browsers may reuse for about 3 days without asking the server. Once a new image is deployed, a user who opens the app from a bookmark gets the old cached index.html. Its <script type="module" src="/assets/index-<old hash>.js"> no longer exists in the new image. try_files {path} /index.html then answers that request with 200 text/html, the browser refuses to run HTML as a module, and the page stays blank until the heuristic expires or the user force-reloads. The same fallback breaks any tab left open across an upgrade. Route chunks are code-split (autoCodeSplitting: true), so the next navigation imports an old chunk and gets HTML back instead of a 404. #936 tracks the same caching problem for the playground image. This issue is the clinician-facing web image.
Where
apps/web/Caddyfile:1-6:
:80 {
root * /srv
encode gzip zstd
try_files {path} /index.html
file_server
}
apps/web/Dockerfile:30 rewrites index.html at every container start:
CMD [ "sh", "-c", "import-meta-env -x .env.public -p index.html && caddy run --config /etc/caddy/Caddyfile --adapter caddyfile" ]
Reproduce
- Run
caddy:2.7-alpinewithapps/web/Caddyfileover a/srvcontainingindex.htmlandassets/index-NEW.js. - Run
curl -I /andcurl -I /assets/index-OLD.js.
Actual (verified locally): / returns 200 with Last-Modified and ETag and no Cache-Control. /assets/index-OLD.js, which does not exist, returns 200 Content-Type: text/html with the body of index.html.
Expected: index.html is sent with Cache-Control: no-cache, so every navigation revalidates it, and a missing /assets/* file returns 404.
Tests
No unit or Playwright test runs the production Caddy image. The e2e suite drives the Vite dev server. Verify the fix with the curl checks above against the built image, using docker compose up -d web caddy and curl -I http://localhost:$APP_PORT/ and /assets/does-not-exist.js.
Suggested fix
In apps/web/Caddyfile, give /assets/* its own handle with file_server and no try_files fallback, and set header Cache-Control "public, max-age=31536000, immutable" there, since those files are content-hashed. In the SPA fallback handle, set header Cache-Control "no-cache" so index.html is always revalidated. With the 404 in place, apps/web can also listen for Vite's vite:preloadError and reload, which covers tabs left open across an upgrade.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 19
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 56
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Maintainers usually reply within 1 day
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Maintainers usually reply within 1 day
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
component:sight
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agentic-os-org/ANOLISA#6738 · 2 comments ·
Maintainers usually reply within 1 day
-
bug Durable Agents Observability (AI Telemetry) status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
mastra-ai/mastra#26470 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
paperclipai/paperclip#15630 ·
Maintainers usually reply within 1 day
-
[good first issue, hacktoberfest] ⛩️ Add new Theme: Sakura Latte (good-first-issue)Possibly taken @PGrayCS claimed this today. Opencommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
lingdojo/kana-dojo#31937 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
feature/cohorts feature/feature-flags team/feature-flags
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day