Skip to content

Commit

Permalink
change whitelist for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kriyip committed Apr 13, 2024
1 parent 404791e commit ec7bdad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ const serverPort = process.env.SERVER_PORT;
// Express is used to define API endpoints
const app = express(express.json());

const whitelist = ['http://localhost:3000', 'https://group-project-team-7-3yebnl906-kriyips-projects.vercel.app'];
const whitelist = ['http://localhost:3000', 'https://*.vercel.app'];
const corsOptions = {
origin: function (origin, callback) {
if (!origin || whitelist.indexOf(origin) !== -1) {
callback(null, true);
if (!origin) return callback(null, true);
if (whitelist.some(d => new RegExp(d).test(origin))) {
callback(null, true);
} else {
callback(new Error('Not allowed by CORS'));
callback(new Error('Not allowed by CORS'));
}
},
credentials: true,
Expand Down

0 comments on commit ec7bdad

Please sign in to comment.