mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
Adjusted
This commit is contained in:
@@ -47,8 +47,13 @@ const PORT = process.env.PORT || 3000;
|
||||
// ──────────────────────────────────────────────────────────────────────────────
|
||||
app.set('trust proxy', 1); // Required for rate-limiter behind proxies/load balancers
|
||||
|
||||
const allowedOrigins = (process.env.ALLOWED_ORIGINS || process.env.APP_URL || '*').split(',');
|
||||
|
||||
app.use(cors({
|
||||
origin: process.env.APP_URL || '*',
|
||||
origin: (origin, callback) => {
|
||||
if (!origin || allowedOrigins.includes(origin)) return callback(null, true);
|
||||
callback(new Error(`CORS: origin ${origin} not allowed`));
|
||||
},
|
||||
credentials: true,
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user