restrict CORS to env defined origin
This commit is contained in:
parent
c94c64b106
commit
8a203cb096
3 changed files with 10 additions and 1 deletions
5
packages/server/server/package-lock.json
generated
5
packages/server/server/package-lock.json
generated
|
@ -269,6 +269,11 @@
|
|||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"cookie-parser": "~1.4.4",
|
||||
"cors": "^2.8.5",
|
||||
"debug": "~2.6.9",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "~4.16.1",
|
||||
"http-errors": "~1.6.3",
|
||||
"morgan": "~1.9.1",
|
||||
|
|
|
@ -6,13 +6,16 @@ const path = require('path');
|
|||
const cookieParser = require('cookie-parser');
|
||||
const logger = require('morgan');
|
||||
|
||||
const dotenv = require('dotenv');
|
||||
dotenv.config();
|
||||
|
||||
const indexRouter = require('./routes/index');
|
||||
const usersRouter = require('./routes/users');
|
||||
|
||||
const app = express();
|
||||
|
||||
const corsOptions = {
|
||||
origin: '*'
|
||||
origin: process.env.REACT_ADDRESS
|
||||
}
|
||||
|
||||
app.options('*', cors(corsOptions));
|
||||
|
|
Loading…
Reference in a new issue