/** * @name 代理的配置 * @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 * ------------------------------- * 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 */ // 后端 build-flow.api 监听地址。 // - 默认 5667:appsettings.json 的 Kestrel.Endpoints.Http.Url(run-dev.sh 里 `--urls 5200` 不会覆盖 Kestrel 配置节,实测监听 5667)。 // - 全局前缀 /api 在后端 FastEndpoints 里设置(RoutePrefix = "api")。 // - 如需改后端地址,用环境变量 BUILDFLOW_API_TARGET 覆盖(例如远程开发机)。 const DEV_API_TARGET = process.env.BUILDFLOW_API_TARGET || 'http://localhost:5667'; export default { // 本地开发:把 /api/** 全部代理到 build-flow.api 后端 dev: { '/api/': { target: DEV_API_TARGET, changeOrigin: true, // 后端 refresh_token 走 HttpOnly Cookie(Path=/),代理透传 Cookie。 // 开发期 http,cookie Secure=false 由后端 Cookie:Secure 配置控制。 cookieDomainRewrite: '', }, }, test: { '/api/': { target: DEV_API_TARGET, changeOrigin: true, }, }, pre: { '/api/': { target: process.env.BUILDFLOW_API_TARGET || 'http://localhost:5667', changeOrigin: true, }, }, };