简体   繁体   English

代理错误:无法代理请求...从 localhost:3000 到 http://localhost:5000/

[英]Proxy error: Could not proxy request ... from localhost:3000 to http://localhost:5000/

How to fix the error below?如何修复下面的错误? Proxy error: Could not proxy request /api/auth/register from localhost:3000 to http://localhost:5000/.代理错误:无法代理请求 /api/auth/register 从 localhost:3000 到 http://localhost:5000/。 1 See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). 1有关详细信息,请参阅https://nodejs.org/api/errors.html#errors_common_system_errors (ECONNREFUSED)。

在此处输入图像描述

Run backend and this error will be removed automatically.运行后端,此错误将自动删除。

You must have set "proxy": "http://localhost:5000/" in your package.json in your client side.您必须在客户端的 package.json 中设置"proxy": "http://localhost:5000/" What this does is that it prefixes every request with the proxy.这样做的目的是为每个请求加上代理前缀。

So this problem will arise if your backend server is listening at port other than 5000(since your every request will be directed at http://localhost:5000/<api> )因此,如果您的后端服务器正在侦听 5000 以外的端口,则会出现此问题(因为您的每个请求都将指向http://localhost:5000/<api>

SOLUTION:解决方案:

either change the proxy to what your backend server is listening at or change the backend server's listening port to what the proxy is set at.要么将代理更改为您的后端服务器正在侦听的内容,要么将后端服务器的侦听端口更改为代理设置的内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 代理错误:无法代理请求/用户从 localhost:3000 到 http://localhost:5000/ - Proxy error: Could not proxy request /users from localhost:3000 to http://localhost:5000/ 出现错误:无法将请求/ api / plaid / accounts从localhost:3000代理到http:// localhost:5000 / - getting error : Could not proxy request /api/plaid/accounts from localhost:3000 to http://localhost:5000/ “React 代理错误:无法将请求 /api/ 从 localhost:3000 代理到 http://localhost:5000 (ECONNREFUSED)”?错误.. 没有在线解决方案 - "React Proxy error: Could not proxy request /api/ from localhost:3000 to http://localhost:5000 (ECONNREFUSED)'? Error.. No solution online 代理错误:无法代理请求 /api/house-listing 从 localhost:3000 到 http://localhost:5000? (ECONNRESET)、MERN - Proxy error: Could not proxy request /api/house-listing from localhost:3000 to http://localhost:5000? (ECONNRESET), MERN Docker 代理错误:无法从 localhost:3000 代理请求 /api/product/B002QYW8LW 到 http://localhost:5000 - Docker proxy error: Could not proxy request /api/product/B002QYW8LW from localhost:3000 to http://localhost:5000 代理错误:无法将请求/用户从localhost:3000代理到http:// localhost:3001 / - Proxy error: Could not proxy request /users from localhost:3000 to http://localhost:3001/ React 代理错误:无法代理请求 /api/ 从 localhost:3000 到 http://localhost:8000 (ECONNREFUSED) - React Proxy error: Could not proxy request /api/ from localhost:3000 to http://localhost:8000 (ECONNREFUSED) 代理错误:无法将请求 /adduser 从 localhost:3000 代理到 http://127.0.0.1/4000 - Proxy error: Could not proxy request /adduser from localhost:3000 to http://127.0.0.1/4000 ReactJS无法代理从localhost:3000到localhost:3003的请求 - ReactJS could not proxy request from localhost:3000 to localhost:3003 无法从localhost:3000代理请求到localhost:7000 ReactJs - Could not proxy request from localhost:3000 to localhost:7000 ReactJs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM