Commit 55d4b349 by luyt

add:change egg-core config

1 parent e5e81f9d
...@@ -15,15 +15,16 @@ module.exports = appInfo => { ...@@ -15,15 +15,16 @@ module.exports = appInfo => {
enable: false, enable: false,
ignoreJSON: true ignoreJSON: true
}, },
domainWhiteList: ["http://localhost:8080", "http://192.168.2.9:8080","*"] //允许访问接口的白名单 domainWhiteList: [ '*' ]
// domainWhiteList: ["http://localhost:8080", "http://192.168.2.9:8080","http://glsk-front.test.glsx.com.cn",] //允许访问接口的白名单
}; };
config.cors = { config.cors = {
// 任何地址都可以访问 // 任何地址都可以访问
origin:"*", origin: ctx => ctx.get('origin'), //这种方式是允许所有的IP+端口跨域访问
// 指定地址才可以访问 // 指定地址才可以访问
// origin: 'http://localhost:8080', // origin: 'http://localhost:8080',
// allowMethods: 'GET,PUT,POST,DELETE', allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
allowMethods: '*', // allowMethods: '*',
// cookie跨域配置 // cookie跨域配置
credentials: true credentials: true
}; };
......
exports.sequelize = { module.exports = {
sequelize:{
enable: true, enable: true,
package: 'egg-sequelize', package: 'egg-sequelize',
}; },
exports.cors = { cors:{
enable: true, enable: true,
package: 'egg-cors', package: 'egg-cors',
}; }
}
// exports.sequelize = {
// enable: true,
// package: 'egg-sequelize',
// };
// exports.cors = {
// enable: true,
// package: 'egg-cors',
// };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!