Web image serves index.html without Cache-Control and answers missing assets with index.html, so the app loads blank after an upgrade
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 79/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- docker, typescript
Línea de trabajo
Empieza con apps/web/Caddyfile y los pasos para reproducir el problema del issue; identifican los comportamientos de las cabeceras de caché y de los recursos ausentes que hay que verificar. Compila y ejecuta la imagen web con docker compose up -d web caddy, y luego usa las comprobaciones curl -I indicadas para / y una ruta /assets/ inexistente. El trabajo estará listo cuando se vuelva a validar el punto de entrada de la aplicación y los recursos ausentes devuelvan 404; verifica que los recursos con hash conserven una caché inmutable de larga duración si implementas la configuración sugerida.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 119
- Forks
- 19
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 56
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
Los mantenedores suelen responder en 1 día
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
Los mantenedores suelen responder en 1 día
Todos los issues de DouglasNeuroInformatics/OpenDataCapture
Issues similares
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster no-stale P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
openclaw/openclaw#168089 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
✨ enhancement needs-discussion
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
[Bug]: [MCP/CLI] Bare loopback IP addresses (127.0.0.1:port) and hosts with ports fail to navigate due to erroneous scheme inferencePosiblemente ocupada @alok-108 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/playwright#43263 ·
Los mantenedores suelen responder en 1 día
-
area:studio type:security
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue Stellar Wave trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
StellarCanary/ProtocolCanary-Action#331 ·
Los mantenedores suelen responder en 1 día