Skip to content

Commit

Permalink
fix: added credentials to cors
Browse files Browse the repository at this point in the history
  • Loading branch information
AishwaryVishwakarma committed Feb 11, 2024
1 parent e79911b commit a3b680f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ var allowedOrigins = [
app.use(
cors({
origin: function (origin, callback) {
// allow requests with no origin
// (like mobile apps or curl requests)
// allow requests with no origin (like mobile apps or curl requests)
// if(!origin) return callback(null, true);
if (allowedOrigins.indexOf(origin) === -1) {
console.log('if block');
var msg =
'The CORS policy for this site does not allow access from the specified Origin.';
return callback(new Error(msg), false);
}
return callback(null, true);
},
credentials: true,
})
);

Expand Down
2 changes: 1 addition & 1 deletion web/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_HOST=https://lazy-pink-seagull-toga.cyclic.app/
NEXT_PUBLIC_HOST=https://netflix-server.up.railway.app/

0 comments on commit a3b680f

Please sign in to comment.