perf:增加proxy代理

This commit is contained in:
曾文豪
2022-05-20 14:32:12 +08:00
parent cc490f674e
commit dafb9634e6
2 changed files with 24 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import {defineConfig} from 'umi'; import {defineConfig} from 'umi';
import proxy from './proxy';
export default defineConfig({ export default defineConfig({
publicPath: "./", publicPath: "./",
@@ -9,6 +10,6 @@ export default defineConfig({
hash: true, hash: true,
history: { history: {
type: "browser" type: "browser"
} },
proxy
}); });

21
config/proxy.js Normal file
View File

@@ -0,0 +1,21 @@
/**
* 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
* The agent cannot take effect in the production environment
* so there is no configuration of the production environment
* For details, please see
* https://pro.ant.design/docs/deploy
*/
//线上
const serverApi = 'http://localhost:8100';
// const serverApi = 'http://192.168.3.128:8100';
export default {
'/manager': {target: serverApi, changeOrigin: true, pathRewrite: {'^': ''}},
'/tools': {target: serverApi, changeOrigin: true, pathRewrite: {'^': ''}},
'/ops': {target: serverApi, changeOrigin: true, pathRewrite: {'^': ''}},
'/auth': {target: serverApi, changeOrigin: true, pathRewrite: {'^': ''}},
'/organ': {target: serverApi, changeOrigin: true, pathRewrite: {'^': ''}},
'/common': {target: serverApi, changeOrigin: true, pathRewrite: {'^': ''}},
};