feat(37回调): 添加大区集中转发接口

This commit is contained in:
luying
2022-11-09 16:21:24 +08:00
parent 81f0997304
commit e442fa6e7c
8 changed files with 177 additions and 48 deletions

View File

@@ -16,24 +16,7 @@ export default (appInfo: EggAppInfo) => {
url: '127.0.0.1', // 内网
pw: ''
};
let regions = [ // 大区数据
{ id: 1, env: 'development', name: "测试", domain: 'http://127.0.0.1:9000' },
];
config.regions = regions;
let httpProxy: any = {};
for(let { env, domain } of regions) {
httpProxy[`/web/${env}/`] = {
target: domain,
changeOrigin: true,
secure: true,
pathRewrite: function(path) {
console.log('proxy', path, path.replace(`/web/${env}/`, '/web/'))
return path.replace(`/web/${env}/`, '/web/')
}
}
}
config.proxy = httpProxy;
config.decodeParm = true;
// the return config will combines to EggAppConfig