700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > [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:8

时间:2023-03-14 05:34:01

相关推荐

[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) (/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’: ‘’ },

},

注意:

使用npm run start:no-mock启动后,一定要保证你的后端服务也是启动的。

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