fix(core): CORS middleware should not process the entire handler chain on OPTIONS requests (no-changelog) (#5368)

fix(core): CORS middleware should not process the entire handler chain on OPTIONS requests
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-02-06 12:43:50 +01:00 committed by GitHub
parent e4458b48e0
commit a115baa1ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,5 +11,10 @@ export const corsMiddleware: RequestHandler = (req, res, next) => {
'Origin, X-Requested-With, Content-Type, Accept, sessionid',
);
}
if (req.method === 'OPTIONS') {
res.writeHead(204).end();
} else {
next();
}
};