Skip to content

Commit e7b8f6e

Browse files
committed
feat(deploy): add cors logic three
1 parent af7bf51 commit e7b8f6e

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

.github/workflows/deploy-stage.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,23 @@ jobs:
6565
git reset --hard origin/stage
6666
6767
cd nodejs-autospace/api-gateway
68-
pnpm install --prod --ignore-scripts
68+
pnpm install
69+
pnpm build
6970
pm2 restart api-gateway || pm2 start dist/index.js --name api-gateway
7071
7172
cd ~/auth-service/autospace/nodejs-autospace/auth-service
72-
pnpm install --prod --ignore-scripts
73+
pnpm install
74+
pnpm build
7375
pm2 restart auth-service || pm2 start dist/server.js --name auth-service
7476
7577
cd ~/resource-service/autospace/nodejs-autospace/resource-service
76-
pnpm install --prod --ignore-scripts
78+
pnpm install
79+
pnpm build
7780
pm2 restart resource-service || pm2 start dist/server.js --name resource-service
7881
7982
cd ~/booking-service/nodejs-autospace/booking-service
80-
pnpm install --prod --ignore-scripts
83+
pnpm install
84+
pnpm build
8185
pm2 restart booking-service || pm2 start dist/server.js --name booking-service
8286
8387
echo " Clean frontend..."

nodejs-autospace/api-gateway/src/index.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,21 @@ app.use(helmet());
2727

2828
// in local commend that here change on lacal
2929

30-
const allowedOrigins = [
31-
"https://autospace.space",
32-
"https://www.autospace.space",
33-
];
34-
35-
app.set("trust proxy", 1);
36-
3730
app.use(
3831
cors({
3932
origin: (origin, callback) => {
4033
if (!origin) return callback(null, true);
4134

42-
if (allowedOrigins.includes(origin)) {
35+
if (
36+
origin === "https://autospace.space" ||
37+
origin === "https://www.autospace.space"
38+
) {
4339
return callback(null, true);
4440
}
4541

46-
console.log(" Blocked by CORS:", origin);
42+
console.log("Blocked by CORS:", origin);
4743

48-
return callback(null, false);
44+
return callback(null, false); // THIS LINE ONLY
4945
},
5046
credentials: true,
5147
}),

0 commit comments

Comments
 (0)