This commit is contained in:
2026-09-20 14:22:17 +08:00
parent 69521095e8
commit 3ba8809222
5 changed files with 29 additions and 4 deletions
+2 -1
View File
@@ -27,6 +27,7 @@ export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const domesticTarget = env.API_PROXY_TARGET || 'http://127.0.0.1:9000'
const overseasTarget = env.OVERSEAS_API_PROXY_TARGET || 'http://127.0.0.1:9300'
const preserveOverseasPrefix = env.OVERSEAS_API_PROXY_PRESERVE_PREFIX === 'true'
return {
plugins: [uni()],
define: {
@@ -41,7 +42,7 @@ export default defineConfig(({ mode }) => {
'/overseas-api': loggedProxy('overseas', {
target: overseasTarget,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/overseas-api/, '/api')
rewrite: (path) => preserveOverseasPrefix ? path : path.replace(/^\/overseas-api/, '/api')
})
}
},