Files
test-alert/config/proxy.ts
2026-04-07 14:23:09 +08:00

54 lines
1.7 KiB
TypeScript

/**
* @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,
},
},
};