Skip to content

Commit

Permalink
Update CORS settings for different environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ru Chern Chong committed Jun 1, 2024
1 parent 8b84cc2 commit 57e60b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down Expand Up @@ -31,7 +37,7 @@ export default $config({
handler: "src/index.handler",
url: {
cors: {
allowOrigins: [`https://${DOMAIN_NAME}`],
allowOrigins: [CORS[$app.stage]],
maxAge: "1 day",
},
},
Expand Down

0 comments on commit 57e60b7

Please sign in to comment.