blob: bd21b273644344864a9ceba7cceb4238093369f4 [file] [log] [blame]
Jiarenxiang38dcb052025-03-13 16:40:09 +08001/**
2 * @name 代理的配置
3 * @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
4 * -------------------------------
5 * The agent cannot take effect in the production environment
6 * so there is no configuration of the production environment
7 * For details, please see
8 * https://pro.ant.design/docs/deploy
9 *
10 * @doc https://umijs.org/docs/guides/proxy
11 */
12export default {
13 // 如果需要自定义本地开发服务器 请取消注释按需调整
14 dev: {
liangjiabaoc79b5122025-06-05 18:53:52 +080015 // localhost:5004/api/** -> https://preview.pro.ant.design/api/**
Jiarenxiang38dcb052025-03-13 16:40:09 +080016 '/api/': {
17 // 要代理的地址
liangjiabaoc79b5122025-06-05 18:53:52 +080018 target: 'http://localhost:5004',
Jiarenxiang38dcb052025-03-13 16:40:09 +080019 // 配置了这个可以从 http 代理到 https
20 // 依赖 origin 的功能可能需要这个,比如 cookie
21 changeOrigin: true,
22 pathRewrite: { '^/api': '' },
23 },
24 '/profile/avatar/': {
liangjiabaoc79b5122025-06-05 18:53:52 +080025 target: 'http://localhost:5004',
Jiarenxiang38dcb052025-03-13 16:40:09 +080026 changeOrigin: true,
27 }
28 },
Jiarenxiang36728482025-06-07 21:51:26 +080029 start: {
30 // localhost:5004/api/** -> https://preview.pro.ant.design/api/**
31 '/api/': {
32 // 要代理的地址
33 target: 'http://team4.10813352.xyz:5004',
34 // 配置了这个可以从 http 代理到 https
35 // 依赖 origin 的功能可能需要这个,比如 cookie
36 changeOrigin: true,
37 pathRewrite: { '^/api': '' },
38 },
39 '/profile/avatar/': {
40 target: 'http://team4.10813352.xyz:5004',
41 changeOrigin: true,
42 }
43 },
Jiarenxiang38dcb052025-03-13 16:40:09 +080044
45 /**
46 * @name 详细的代理配置
47 * @doc https://github.com/chimurai/http-proxy-middleware
48 */
49 test: {
liangjiabaoc79b5122025-06-05 18:53:52 +080050 // localhost:5004/api/** -> https://preview.pro.ant.design/api/**
Jiarenxiang38dcb052025-03-13 16:40:09 +080051 '/api/': {
52 target: 'https://proapi.azurewebsites.net',
53 changeOrigin: true,
54 pathRewrite: { '^': '' },
55 },
56 },
Jiarenxiang36728482025-06-07 21:51:26 +080057
58
Jiarenxiang38dcb052025-03-13 16:40:09 +080059 pre: {
60 '/api/': {
61 target: 'your pre url',
62 changeOrigin: true,
63 pathRewrite: { '^': '' },
64 },
65 },
66};