diff --git a/server.js b/server.js index aa5fa50..0cfe712 100644 --- a/server.js +++ b/server.js @@ -101,11 +101,11 @@ app.use(fileUpload({ })); const corsOptions = { origin: (origin, callback) => { - if (!origin || config.allowed_domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) { + if (!origin || config.domain == origin.replace(/:\d*$/g, "") || config.allowed_domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) { callback(null, true); } else { database.system.domains((domains) => { - if (config.domain == origin.replace(/:\d*$/g, "") || domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) { + if (domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) { callback(null, true); } else { callback("Origin not allowed: " + origin);