[HPM] Error occurred while trying to proxy request /login/account from localhost:8000 to localhost:8

[HPM] Error occurred while trying to proxy request /login/account from localhost:8000 to localhost:8888/api/ (ENOTFOUND) (https://nodejs.org/api/errors.html#errors_c
ommon_system_errors)

antd pro 2.0 前端服务器代理,出现该错误。
原因:target地址上没写http协议。
错误写法:
proxy: {
‘/api’: {
target: ‘localhost:8888/api/’,
changeOrigin: true,
pathRewrite: { ‘^/api’: ‘’ },
},
正确写法:
proxy: {
‘/api’: {
target: ‘http://localhost:8888/api/’,
changeOrigin: true,
pathRewrite: { ‘^/api’: ‘’ },
},

猜你喜欢

转载自blog.csdn.net/my_wings/article/details/85618184