100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > proxy跨域不生效_vue-cli 解决跨域 proxyTable设置无效 报错504 node报错 代理错误

proxy跨域不生效_vue-cli 解决跨域 proxyTable设置无效 报错504 node报错 代理错误

时间:2019-12-17 09:25:23

相关推荐

proxy跨域不生效_vue-cli 解决跨域 proxyTable设置无效 报错504 node报错 代理错误

后台服务器名 http://47.92.100.92:9002,配置 proxyTable:

proxyTable: {

'/api':{

target: 'http://47.92.100.92:9002/',

changeOrigin: true,

pathRewrite: {

'^api': '/api'

}

}

},

在组件login中拿数据的时候

methods: {

Sign() {

axios.post("/api/login", qs.stringify({

username: that.loginInfo.username,

password: that.loginInfo.userpass

}),{

headers: {

"Content-Type": "application/x-www-form-urlencoded",

"Accept":"application/json"

}

}).then((response) => {

//数据 success

// this.myData = res.data.info

Indicator.close();

console.log(response)

}, (error) => {

// error

Indicator.close();

console.log(error)

});

}

}

当点击Sign的时候浏览器报错

node报错

Your application is running here: http://localhost:8080 [HPM] Error occurred while trying to proxy request /api/login from localhost:8080 to http://47.92.100.92:9002/ (ECONNREFUSED) (/api/errors…

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。