Browse Source

添加在线代理

max 5 months ago
parent
commit
386c6a7a43
2 changed files with 9 additions and 0 deletions
  1. 1 0
      src/api/index.js
  2. 8 0
      vite.config.js

+ 1 - 0
src/api/index.js

@@ -2,6 +2,7 @@ import request from '@/utils/request';
 // const HOST = 'http://localhost:9000/dev/admin/dj/open/cashier'
 const HOST = 'https://cashier.fusionpay.one/api/admin/dj/open'
 // const HOST = 'http://localhost:8001/admin/dj/open'
+// const HOST = '/api'
 
 // 获取KYC级别
 export function getOrder(data) {

+ 8 - 0
vite.config.js

@@ -14,5 +14,13 @@ export default defineConfig({
     server: {
         host: '0.0.0.0',
         port: 8080,
+        proxy: {
+            // 代理 /api 路径到 www.baidu.com/api
+            '/api': {
+                target: 'https://cashier.fusionpay.one/api/admin/dj/open', // 目标地址
+                changeOrigin: true, // 是否改变源地址
+                rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉 /api 前缀
+            },
+        },
     }
 })