vue启动报错Error occurred while trying to proxy request
年久失修的代码竟然重启报错放了三个月的代码,因为有小bug需要调整。启动后运行一直报错Error occurred while trying to proxy request 。。。既然是proxy相关,那就找运行配置的文件吧哦吼!!!好厉害 localhost 为什么要写成 location...
·
2021年9月1日-更新
跨域不起效果,可以定义:
axios.defaults.baseURL = '/api'
2021年8月26日-更新
还有可能是配置的顺序问题,proxyTable的配置后放到配置项最下面
2021年8月19日-更新
所有的配置都对,启动还是出现了这个错误。proxyTable下的pathRewrite,原来配置的是 '^/': '',直接把接口重写了,导致请求的后台接口直接504。可以前面写一个其他的字段去匹配。匹配不到自然不会重写接口地址。
更改后,一定要重启
proxyTable: {
'/': {
target: 'http://localhost:8889',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
年久失修的代码竟然重启报错
放了三个月的代码,因为有小bug需要调整。启动后运行一直报错
Error occurred while trying to proxy request 。。。
既然是proxy相关,那就找运行配置的文件吧
哦吼!!!好厉害 localhost 为什么要写成 location
更多推荐
已为社区贡献2条内容
所有评论(0)