Add ACAO header
This commit is contained in:
parent
8f751161b1
commit
ab46e680dc
3 changed files with 17 additions and 0 deletions
7
app.js
7
app.js
|
@ -4,6 +4,7 @@ const logger = require('morgan');
|
|||
const cookieParser = require('cookie-parser');
|
||||
const bodyParser = require('body-parser');
|
||||
const sassMiddleware = require('node-sass-middleware');
|
||||
const cors = require("cors");
|
||||
const protocol = require("./src/utils/connection");
|
||||
// const favicon = require('serve-favicon');
|
||||
|
||||
|
@ -45,6 +46,12 @@ app.use((req, res, next) => {
|
|||
next();
|
||||
});
|
||||
|
||||
const corsOpt = {
|
||||
origin: process.env.CORS_ALLOW_ORIGIN || '*'
|
||||
};
|
||||
app.use(cors(corsOpt));
|
||||
app.options('*', cors(corsOpt));
|
||||
|
||||
app.use(subdomain('api', api));
|
||||
app.use(subdomain('cufs', cufs));
|
||||
app.use(subdomain('uonetplus', uonetplus));
|
||||
|
|
9
package-lock.json
generated
9
package-lock.json
generated
|
@ -853,6 +853,15 @@
|
|||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
},
|
||||
"cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"requires": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
}
|
||||
},
|
||||
"create-error-class": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz",
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"dependencies": {
|
||||
"body-parser": "~1.18.3",
|
||||
"cookie-parser": "^1.4.4",
|
||||
"cors": "^2.8.5",
|
||||
"csrf": "^3.0.6",
|
||||
"date-fns": "^2.0.0-alpha.27",
|
||||
"debug": "^4.1.1",
|
||||
|
|
Loading…
Reference in a new issue