ice
ice copied to clipboard
ice3配置proxy失效,不起作用,无法进行跨域代理
Describe the bug
在ice3的配置文件ice.config.mts中配置如下proxy失效:
proxy: { '/test': { changeOrigin: true, // eslint-disable-next-line @iceworks/best-practices/no-http-url target: 'https://xxxxxxxxx.xxxx.cn:1443', pathRewrite: {'^/test': '/api'}, }, },
Expected behavior
急需解决
Actual behavior
No response
Version of ice.js
ice3
Content of build.json or ice.config.mts
No response
Additional context
No response
提供下完整的 ice.config.mts
配置
ice.config.mts配置 ` import {defineConfig} from '@ice/app'; import request from '@ice/plugin-request'; import store from '@ice/plugin-store'; import auth from '@ice/plugin-auth'; import jsxPlus from '@ice/plugin-jsx-plus';
const minify = process.env.NODE_ENV === 'production' ? 'swc' : false; export default defineConfig(() => ({ publicPath: '/', // 默认发布路径 proxy: { '/test': { target: 'http://10.112.138.188:8006', changeOrigin: true, pathRewrite: {'^/test': 'api/v1'}, }, }, // 代理请求 ssr: false, ssg: false, minify, // 压缩产物,目前默认仅在 build 阶段生效 dropLogLevel: 'log', // 压缩代码时移除console plugins: [ request(), store(), auth(), jsxPlus(), ], compileDependencies: false, }));
`
提供下完整的
ice.config.mts
配置
app:ts配置:
解决没,我也遇到相同的问题