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

This commit is contained in:
silverpro89
2026-02-24 14:35:32 +07:00
parent d3da098f6f
commit d0f41920f7

9
app.js
View File

@@ -69,8 +69,15 @@ app.use(helmet({
}, },
})); }));
app.use(cors({ app.use(cors({
origin: config.cors.origin, origin: (origin, callback) => {
// Allow requests with no origin (mobile apps, Postman, server-to-server)
if (!origin) return callback(null, true);
// Allow all origins but still support credentials
return callback(null, true);
},
credentials: true, credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],
})); }));
/** /**