fix: update CORS middleware to retrieve multiple allowed origins from the database
Deploy Application / deploy (push) Successful in 36s
Details
Deploy Application / deploy (push) Successful in 36s
Details
This commit is contained in:
parent
83ac69ac71
commit
ccccb9d63b
|
|
@ -67,11 +67,11 @@ app.use((req, res, next) => {
|
|||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
const originCors = await db.whitelistcors.findFirst({
|
||||
const originCors = await db.whitelistcors.findMany({
|
||||
where: { is_active: "Y" },
|
||||
});
|
||||
if (originCors) {
|
||||
allowedOrigins.push(originCors.origin);
|
||||
if (originCors.length > 0) {
|
||||
allowedOrigins.push(...originCors.map((item) => item.origin));
|
||||
}
|
||||
corsCache.set(cacheKey, {
|
||||
origins: allowedOrigins,
|
||||
|
|
|
|||
Loading…
Reference in New Issue