diff --git a/web/.env.development b/web/.env.development index e37c5b2..d4aa8df 100644 --- a/web/.env.development +++ b/web/.env.development @@ -5,4 +5,4 @@ VITE_PUBLIC_PATH = '/' VITE_USE_PROXY = true # base api -VITE_BASE_API = '/api' +VITE_BASE_API = '/api/v1' diff --git a/web/.env.production b/web/.env.production index 88cf20f..326f1e3 100644 --- a/web/.env.production +++ b/web/.env.production @@ -2,7 +2,7 @@ VITE_PUBLIC_PATH = '/' # base api -VITE_BASE_API = '/api' +VITE_BASE_API = '/api/v1' # 是否启用压缩 VITE_USE_COMPRESS = true diff --git a/web/build/constant.js b/web/build/constant.js index 880cc2a..17a1bf0 100644 --- a/web/build/constant.js +++ b/web/build/constant.js @@ -1,23 +1,23 @@ export const OUTPUT_DIR = 'dist' export const PROXY_CONFIG = { - /** - * @desc 替换匹配值 - * @请求路径 http://localhost:3100/api/user - * @转发路径 http://localhost:9999/api/v1 +/user - */ - '/api': { - target: 'http://localhost:9999/api/v1', - changeOrigin: true, - rewrite: (path) => path.replace(new RegExp('^/api'), ''), - }, // /** - // * @desc 不替换匹配值 - // * @请求路径 http://localhost:3100/api/v1/user - // * @转发路径 http://localhost:9999/api/v1/user + // * @desc 替换匹配值 + // * @请求路径 http://localhost:3100/api/user + // * @转发路径 http://localhost:9999/api/v1 +/user // */ - // '/api/v1': { - // target: 'http://localhost:9999', + // '/api': { + // target: 'http://localhost:9999/api/v1', // changeOrigin: true, + // rewrite: (path) => path.replace(new RegExp('^/api'), ''), // }, + /** + * @desc 不替换匹配值 + * @请求路径 http://localhost:3100/api/v1/user + * @转发路径 http://localhost:9999/api/v1/user + */ + '/api/v1': { + target: 'http://localhost:9999', + changeOrigin: true, + }, }