Fix CORS config for staging environment
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -46,11 +46,17 @@ fs.mkdir(UPLOAD_DIR_IMAGE, {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
const corsConfig = {
|
const corsConfig = {
|
||||||
origin: "*",
|
origin: [
|
||||||
methods: ["GET", "POST", "PATCH", "DELETE", "PUT"] as HTTPMethod[],
|
"http://localhost:3000",
|
||||||
allowedHeaders: "*",
|
"http://localhost:3001",
|
||||||
|
"https://cld-dkr-desa-darmasaba-stg.wibudev.com",
|
||||||
|
"https://cld-dkr-staging-desa-darmasaba.wibudev.com",
|
||||||
|
"*", // Allow all origins in development
|
||||||
|
],
|
||||||
|
methods: ["GET", "POST", "PATCH", "DELETE", "PUT", "OPTIONS"] as HTTPMethod[],
|
||||||
|
allowedHeaders: ["Content-Type", "Authorization", "*"],
|
||||||
exposedHeaders: "*",
|
exposedHeaders: "*",
|
||||||
maxAge: 5,
|
maxAge: 86400, // 24 hours
|
||||||
credentials: true,
|
credentials: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user