Skip to content

Commit

Permalink
Allow CORS from all domains but no wildcard
Browse files Browse the repository at this point in the history
Since credentialed requests are not allowed for wildcard origin
  • Loading branch information
arpit-saxena committed May 30, 2021
1 parent 08c613a commit e52648b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ app.use(compression());
app.use(cookieParser());
app.use(bodyParser.json({type: 'application/json'}));
app.use(bodyParser.urlencoded({extended: true}));
app.use(cors());

const corsOptions = {
origin: true, // Allow all origin ending in devclub.com
credentials: true,
optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
};
app.use(cors(corsOptions));

app.use(helmet());
app.use(lusca.xframe('SAMEORIGIN'));
app.use(lusca.xssProtection(true));
Expand Down

0 comments on commit e52648b

Please sign in to comment.