diff --git a/readmongo/swarmlab-app/src/run/app.js b/readmongo/swarmlab-app/src/run/app.js index e36b817..2d9f83d 100644 --- a/readmongo/swarmlab-app/src/run/app.js +++ b/readmongo/swarmlab-app/src/run/app.js @@ -11,6 +11,16 @@ const { DATABASE, COLLECTION, URL, REDIS, REDIS_PORT, PORT } = process.env; const fs = require('fs'); +const whitelist = [ + "http://localhost:3000", + "http://localhost:8080", + "http://localhost:8085", + "http://localhost:3080", + "http://localhost:3081", + "http://localhost:3082", + "http://webclient.poc-datacollector_datacollector-net:8080", + "http://webclient.poc-datacollector_datacollector-net:8085", +]; const io = require("socket.io")(http, { // pingTimeout: 30000, // allowUpgrades: false, @@ -19,7 +29,8 @@ const io = require("socket.io")(http, { // //transports: [ 'websocket', 'polling' ], // transports: [ 'polling', 'websocket' ], cors: { - origin: "http://localhost:8085", + origin: whitelist, + //origin: "http://localhost:8085", methods: ["GET", "POST"], allowedHeaders: ["my-custom-header"], credentials: true, @@ -72,16 +83,6 @@ app.use(helmet()); const cors = require("cors"); const { MongoError } = require("mongodb"); -const whitelist = [ - "http://localhost:3000", - "http://localhost:8080", - "http://localhost:8085", - "http://localhost:3080", - "http://localhost:3081", - "http://localhost:3082", - "http://webclient.poc-datacollector_datacollector-net:8080", - "http://webclient.poc-datacollector_datacollector-net:8085", -]; const corsOptions = { credentials: true, methods: ["GET", "PUT", "POST", "DELETE", "OPTIONS"],