Skip to content

Commit c91ea28

Browse files
committed
fix: support * cors
1 parent 27a165b commit c91ea28

File tree

1 file changed

+2
-1
lines changed
  • packages/auth-server-api/src

1 file changed

+2
-1
lines changed

packages/auth-server-api/src/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ app.use(express.json());
1414

1515
// CORS configuration
1616
const allowlist = env.CORS_ORIGINS.split(",").map((origin) => origin.trim());
17+
const isAllowAll = allowlist.includes("*");
1718
const corsOrigins = (origin: string | undefined, callback: (err: Error | null, allow?: boolean) => void) => {
18-
if (!origin || allowlist.indexOf(origin) !== -1) {
19+
if (!origin || isAllowAll || allowlist.indexOf(origin) !== -1) {
1920
callback(null, true);
2021
} else {
2122
callback(new Error("Not allowed by CORS"));

0 commit comments

Comments
 (0)