From 1d348cceb16022957a6e839debcbacae89372aa8 Mon Sep 17 00:00:00 2001 From: baishun Date: Fri, 24 Feb 2023 17:38:44 +0800 Subject: [PATCH] =?UTF-8?q?vite=E9=85=8D=E7=BD=AE=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=88=B0=E5=90=8E=E7=AB=AF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/vite.config.js b/vite.config.js index e99d835..e8b9c38 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,5 +16,50 @@ export default defineConfig({ }, server: { port: 3001, + proxy: { + // 选项写法 + "/apaas/data": { + target: "https://apaas5.wodcloud.com/apaas/data", // 所要代理的目标地址 + rewrite: (path) => path.replace(/^\/apaas\/data/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的) + changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL + secure: false, // 解决证书缺失问题 + }, + "/apaas/system": { + target: "https://apaas5.wodcloud.com/apaas/system", + rewrite: (path) => path.replace(/^\/apaas\/system/, ""), + changeOrigin: true, + secure: false, + }, + "/apaas/service": { + target: "https://apaas5.wodcloud.com/apaas/service", + rewrite: (path) => path.replace(/^\/apaas\/service/, ""), + changeOrigin: true, + secure: false, + }, + "/apaas/common": { + target: "https://apaas5.wodcloud.com/apaas/common", + rewrite: (path) => path.replace(/^\/apaas\/common/, ""), + changeOrigin: true, + secure: false, + }, + "/apaas/manage/ui": { + target: "https://apaas5.wodcloud.com/apaas/manage/ui", + rewrite: (path) => path.replace(/^\/apaas\/manage\/ui/, ""), + changeOrigin: true, + secure: false, + }, + "/apaas/portal/v5": { + target: "https://apaas5.wodcloud.com/apaas/portal/v5", + rewrite: (path) => path.replace(/^\/apaas\/portal\/v5/, ""), + changeOrigin: true, + secure: false, + }, + "/apaas/application/v5": { + target: "https://apaas5.wodcloud.com/apaas/application/v5", + rewrite: (path) => path.replace(/^\/apaas\/application\/v5/, ""), + changeOrigin: true, + secure: false, + }, + }, }, }); -- 2.26.0