From 681cf873dd0a1321a65e0b015afa269268a92294 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 8 Jul 2023 18:57:41 +0100 Subject: [PATCH] Update CORS Signed-off-by: Fred Boniface --- app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 3a0d875..c328621 100644 --- a/app.js +++ b/app.js @@ -14,8 +14,8 @@ const app = express(); // Middleware const compression = require('compression'); const rateLimit = require('express-rate-limit'); -const authenticate= require('./src/middlewares/auth.middlewares'); const cors = require('cors'); +const authenticate= require('./src/middlewares/auth.middlewares'); // Internal Requires const log = require('./src/utils/log.utils'); @@ -62,7 +62,10 @@ app.use((err, req, res, next) => { }); // Global Middleware: -app.use(cors()); // Allow access from any origin +app.use(cors({ + origin: [/\.owlboard\.info$/, 'localhost'], + methods:'GET,POST,OPTIONS' +})); app.use(express.json()); //JSON Parsing for POST Requests app.use(compression()); // Compress API Data if supported by client app.use(limiter);