vue-manage-system icon indicating copy to clipboard operation
vue-manage-system copied to clipboard

楼主请帮忙看一下这个问题。

Open LeeYongDae opened this issue 4 years ago • 3 comments

[[我设置了vue.config.js里面的proxy代理地址,但是运行的时候没有去走我设置的代理地址。麻烦帮忙看一下。 devServer: { open:true, proxy: { '/api':{ //target:'http://jsonplaceholder.typicode.com', target:'http://localhost:8089', changeOrigin:true, pathRewrite:{'^/api':''} } } }

LeeYongDae avatar May 08 '20 08:05 LeeYongDae

pathRewrite:{'^/api':''} 是不是要改成这样pathRewrite:{'^/api':'/'}

liulyu avatar May 08 '20 08:05 liulyu

pathRewrite:{'^/api':''} 是不是要改成这样pathRewrite:{'^/api':'/'}

我改成这样后,还是不可以访问我后台的接口。代理过去的还是8080。是不是axios.create()里面也要配置什么?

LeeYongDae avatar May 08 '20 08:05 LeeYongDae

这是表示请求 /api 开头的接口时才会走这个代理,你请求的url是否是 /api 开头?域名不能加载请求的url中的;pathRewrite是实际请求的路径没有 /api 的,这个你的后台接口又是否符合

lin-xin avatar May 13 '20 08:05 lin-xin