We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e62471 commit 312d699Copy full SHA for 312d699
1 file changed
backend/server.js
@@ -15,9 +15,10 @@ const app = express();
15
16
// CORS configuration — allowed origins are read from the ALLOWED_ORIGINS env var
17
// (comma-separated). Falls back to localhost for local development.
18
-const allowedOrigins = process.env.ALLOWED_ORIGINS
19
- ? process.env.ALLOWED_ORIGINS.split(',').map(origin => origin.trim())
20
- : ['http://localhost:5173'];
+const parsedOrigins = process.env.ALLOWED_ORIGINS
+ ? process.env.ALLOWED_ORIGINS.split(',').map(origin => origin.trim()).filter(Boolean)
+ : [];
21
+const allowedOrigins = parsedOrigins.length > 0 ? parsedOrigins : ['http://localhost:5173'];
22
23
app.use(cors({
24
origin: function (origin, callback) {
0 commit comments