From dafb9634e6d79eeffc9f70e55b947c5e2d3ac123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Fri, 20 May 2022 14:32:12 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9A=E5=A2=9E=E5=8A=A0proxy=E4=BB=A3?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.js | 5 +++-- config/proxy.js | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 config/proxy.js diff --git a/config/config.js b/config/config.js index 88b4605..99f1e52 100644 --- a/config/config.js +++ b/config/config.js @@ -1,4 +1,5 @@ import {defineConfig} from 'umi'; +import proxy from './proxy'; export default defineConfig({ publicPath: "./", @@ -9,6 +10,6 @@ export default defineConfig({ hash: true, history: { type: "browser" - } - + }, + proxy }); diff --git a/config/proxy.js b/config/proxy.js new file mode 100644 index 0000000..1c6dd02 --- /dev/null +++ b/config/proxy.js @@ -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: {'^': ''}}, +};