update clear cache
All checks were successful
Deploy to Production / deploy (push) Successful in 20s

This commit is contained in:
silverpro89
2026-01-28 19:54:59 +07:00
parent fa5c293a7e
commit b34bd7a4e3
5 changed files with 21 additions and 81 deletions

12
app.js
View File

@@ -76,8 +76,18 @@ app.use(express.json({ limit: '10mb' }));
app.use(express.urlencoded({ extended: true, limit: '10mb' }));
/**
* Static Files Middleware
* Static Files Middleware with CORS
*/
app.use((req, res, next) => {
// Apply CORS headers for static files (images, media, etc.)
if (req.path.match(/\.(jpg|jpeg|png|gif|svg|webp|ico|mp3|mp4|wav|pdf)$/i)) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
}
next();
});
app.use(express.static('public'));
/**