fix: no-cache headers on JS/CSS + version query params to bust browser cache

This commit is contained in:
root
2026-07-16 11:16:21 +00:00
parent 92291be2b1
commit 046e8be14b
5 changed files with 8 additions and 4 deletions

Binary file not shown.

View File

@@ -840,5 +840,9 @@ async def serve_static(path: str):
"""Serve static files or return index.html for SPA routes."""
file_path = static_dir / path
if file_path.exists() and file_path.is_file():
return FileResponse(str(file_path))
response = FileResponse(str(file_path))
# Prevent caching of JS/CSS so code changes take effect without hard refresh
if path.endswith(('.js', '.css')):
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
return response
return FileResponse(str(static_dir / "index.html"))

View File

@@ -6,6 +6,6 @@
"originalName": "master_cv_template.docx",
"path": "/root/workspace/cv-app/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx",
"uploadedAt": "2026-07-16T09:03:29.601Z",
"updatedAt": "2026-07-16T11:12:12.609Z"
"updatedAt": "2026-07-16T11:15:01.909Z"
}
]

View File

@@ -139,7 +139,7 @@
<!-- Modals -->
<div class="modal-overlay" id="modal-overlay"></div>
<script src="/static/app.js"></script>
<script src="/static/carbone.js"></script>
<script src="/static/app.js?v=2"></script>
<script src="/static/carbone.js?v=2"></script>
</body>
</html>