perf: optimize slider image persistence in DOM and add 1-year immutable cache-control for static uploads
Deploy Canina / deploy (push) Successful in 1m41s

This commit is contained in:
parsa aghaei committed 2026-08-24 15:33:31 +03:30
1 parent 5bf9ac0b2e
commit eb63d22ac4
2 files changed
+36 -14

No files matched your search

+11 -1
View File
@@ -28,12 +28,22 @@ async function bootstrap() {
// Trust reverse proxy (Nginx / Docker ingress) to resolve real client IP from X-Forwarded-For
app.set('trust proxy', true);
// Serve static uploads folder under both /uploads/ and /api/uploads/
// Serve static uploads folder with 1-year aggressive browser caching (immutable)
const staticUploadOptions = {
maxAge: 31536000000, // 1 year in ms
immutable: true,
setHeaders: (res: any) => {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
},
};
app.useStaticAssets(join(process.cwd(), 'uploads'), {
prefix: '/uploads/',
...staticUploadOptions,
});
app.useStaticAssets(join(process.cwd(), 'uploads'), {
prefix: '/api/uploads/',
...staticUploadOptions,
});
app.use(