This commit is contained in:
2026-04-24 20:30:52 +08:00
commit 704bc34625
152 changed files with 45612 additions and 0 deletions

53
config/proxy.ts Normal file
View File

@@ -0,0 +1,53 @@
/**
* @name Proxy configuration
* @see In the production environment, the proxy cannot take effect, so there is no configuration of the production environment
* -------------------------------
* The agent cannot take effect in the production environment
* so there is no configuration of the production environment
* For details, please see
* https://pro.ant.design/docs/deploy
*
* @doc https://umijs.org/docs/guides/proxy
*/
export default {
// If you need to customize the local development server, please uncomment and adjust as needed.
dev: {
'/api': {
// The address to proxy
// target: 'http://2333z061l7.51mypc.cn',
target: 'http://172.20.177.121:8080',
changeOrigin: true,
pathRewrite: {
'^/api': '',
},
// xfwd: true,
onProxyRes: (proxyRes: any, req: { url: string | string[] }) => {
// Tell the browser/proxy not to cache streaming data
if (req.url?.includes('/sse')) {
// Key setting: instruct the browser/proxy not to cache streamed data
proxyRes.headers['Cache-Control'] = 'no-transform';
// For upstream proxies like Nginx, disable buffering (hard to verify effect; set as a precaution).
proxyRes.headers['X-Accel-Buffering'] = 'no';
}
},
},
},
/**
* @name Detailed proxy configuration
* @doc https://github.com/chimurai/http-proxy-middleware
*/
test: {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
'/api': {
target: 'https://proapi.azurewebsites.net',
changeOrigin: true,
},
},
pre: {
'/api/': {
target: 'your pre url',
changeOrigin: true,
},
},
};