ovineio/ovine

如何解决跨域设置代理访问?

touchID opened this issue · 2 comments

在demo项目哪里进行设置?mode吗?

ovine.config.js --> devServer 同webpack设置

ovine.config.js --> devServer 同webpack设置

3q

devServer: {//开发服务器配置
proxy: {
"/api": {
target: "http://xxx.xxx.com",
logLevel: "debug",//开启debug模式后,可在终端查看代理的真实请求地址
ws: true, //代理websockets
changeOrigin: true, // 是否跨域,虚拟的站点需要更管origin
/* 路径重写(代理时发送到target的请求去掉/api前缀) */
pathRewrite: {
"^/api": "/api"
}
}
}
},