feat: handle only preflight & additional headers
This commit is contained in:
@@ -99,10 +99,8 @@ app.get('/', function (req, res) {
|
|||||||
|
|
||||||
// Add CORS headers
|
// Add CORS headers
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
res.header('Access-Control-Allow-Origin', allowedOrigin);
|
|
||||||
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
|
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
|
||||||
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
||||||
res.header('Access-Control-Allow-Credentials', 'true');
|
|
||||||
if (req.method === 'OPTIONS') {
|
if (req.method === 'OPTIONS') {
|
||||||
return res.sendStatus(200);
|
return res.sendStatus(200);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user