Skip to content
Snippets Groups Projects
Commit 77fe8ae2 authored by Alex's avatar Alex
Browse files

fix: origin may be undefined

parent 628d8b67
No related branches found
No related tags found
No related merge requests found
Pipeline #14170 passed
...@@ -21,7 +21,7 @@ container.load(loggerBackendModule); ...@@ -21,7 +21,7 @@ container.load(loggerBackendModule);
//CORS middleware //CORS middleware
const allowCrossDomain = function (req, res, next) { const allowCrossDomain = function (req, res, next) {
if (req.headers.origin.endsWith('.deadlock.io')) { if (req.headers.origin && req.headers.origin.endsWith('.deadlock.io')) {
res.setHeader('Access-Control-Allow-Origin', req.headers.origin); res.setHeader('Access-Control-Allow-Origin', req.headers.origin);
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,Content-Type'); res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,Content-Type');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, DELETE'); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, DELETE');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment