From 57e60b7251b37bcc5543975761499c7f32735a9d Mon Sep 17 00:00:00 2001 From: Ru Chern Chong Date: Sat, 1 Jun 2024 16:39:11 +0800 Subject: [PATCH] Update CORS settings for different environment --- sst.config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sst.config.ts b/sst.config.ts index 5b4dbfd..3d48765 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -2,6 +2,12 @@ const DOMAIN_NAME = "sgmotortrends.com"; +const CORS = { + development: "*", + staging: "*", + production: `https://${DOMAIN_NAME}`, +}; + const DOMAIN = { development: `dev.api.${DOMAIN_NAME}`, staging: `staging.api.${DOMAIN_NAME}`, @@ -31,7 +37,7 @@ export default $config({ handler: "src/index.handler", url: { cors: { - allowOrigins: [`https://${DOMAIN_NAME}`], + allowOrigins: [CORS[$app.stage]], maxAge: "1 day", }, },