Merge branch 'dev' of http://git.buggoglobal.com/html/admin-web into dev
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
VITE_API_BASE_URL=/api
|
||||
# 按本机联调环境填写国内 Gateway origin,不提交真实环境地址。
|
||||
API_PROXY_TARGET=http://localhost:9000
|
||||
# 可选:本地分别直连 Auth、IAM、Warehouse;未设置时复用 API_PROXY_TARGET。
|
||||
# AUTH_API_PROXY_TARGET=http://localhost:9001
|
||||
# IAM_API_PROXY_TARGET=http://localhost:9002
|
||||
# WAREHOUSE_API_PROXY_TARGET=http://localhost:9003
|
||||
# 海外业务浏览器请求使用独立代理,代理会将 /overseas-api 重写为海外 Gateway 的 /api。
|
||||
VITE_OVERSEAS_API_BASE_URL=/overseas-api
|
||||
# 按本机联调环境填写海外 Gateway origin,不提交真实环境地址。
|
||||
|
||||
@@ -8,6 +8,9 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const proxyTarget = env.API_PROXY_TARGET || 'http://localhost:8080'
|
||||
const authProxyTarget = env.AUTH_API_PROXY_TARGET || proxyTarget
|
||||
const iamProxyTarget = env.IAM_API_PROXY_TARGET || proxyTarget
|
||||
const warehouseProxyTarget = env.WAREHOUSE_API_PROXY_TARGET || proxyTarget
|
||||
const overseasProxyTarget = env.OVERSEAS_API_PROXY_TARGET || 'http://localhost:9300'
|
||||
|
||||
return {
|
||||
@@ -30,6 +33,33 @@ export default defineConfig(({ mode }) => {
|
||||
server: {
|
||||
strictPort: true,
|
||||
proxy: {
|
||||
'/api/auth': {
|
||||
target: authProxyTarget,
|
||||
changeOrigin: true,
|
||||
configure(proxy) {
|
||||
proxy.on('proxyReq', (proxyRequest) => {
|
||||
proxyRequest.removeHeader('origin')
|
||||
})
|
||||
},
|
||||
},
|
||||
'/api/platform/v1/iam': {
|
||||
target: iamProxyTarget,
|
||||
changeOrigin: true,
|
||||
configure(proxy) {
|
||||
proxy.on('proxyReq', (proxyRequest) => {
|
||||
proxyRequest.removeHeader('origin')
|
||||
})
|
||||
},
|
||||
},
|
||||
'/api/platform/v1/warehouse-admin': {
|
||||
target: warehouseProxyTarget,
|
||||
changeOrigin: true,
|
||||
configure(proxy) {
|
||||
proxy.on('proxyReq', (proxyRequest) => {
|
||||
proxyRequest.removeHeader('origin')
|
||||
})
|
||||
},
|
||||
},
|
||||
'/api': {
|
||||
target: proxyTarget,
|
||||
changeOrigin: true,
|
||||
|
||||
Reference in New Issue
Block a user