vue配置代理调取不到接口是为什么?

proxyTable配置如下:

var chost = '10.28.41.67:8080'
proxyTable: {
    '/ias-web': {
        target: 'http://' + chost + '/ias-web',
        changeOrigin: true,
        pathRewrite: {
            '^/ias-web': ''
        }
    }
}

但实际调取后台接口的时候404
图片描述

这是为什么?

补上请求代码,用的axios

this.axios.post('addmodel', params)
.then(res => {
    // Todo
})
.catch(err => {
    this.$message.error(err.msg)
})
阅读 5k
2 个回答

请求的代码呢

target: 'http://' + chost; 后面的接口不要再加上了。

推荐问题