proxy
来源:7-3 登录页面的开发(2)

悟空工作室
2019-01-16
老师,您好,我在配置webpack跨域时,发现不管用,提交时,还是走8086端口,请问是什么问题呢?
以下是请求代码和proxy的配置
_mm.request({
type : 'post',
url : '/manage/admin/login.do',
data : {
username : this.state.username,
password : this.state.password
}
}).then((res) => {
console.log(res);
}, (err) => {
console.log(err);
});
devServer: {
port: 8086,
historyApiFallback: {
index: '/dist/index.html'
},
proxy : {
'/manage': {
target: 'http://localhost:8080/',
changeOrigin: true,
secure: false
}
}
}
写回答
1回答
-
浏览器里看着接口就是走8086接口,到了webpack-dev-server以后实际上会去8080端口拿东西。如果是拿不到,一般就是路径匹配的问题。仔细检查下,不行代码打包发我
022019-01-18
相似问题