简体   繁体   English

我无法连接到本地主机上的服务器

[英]I Can't connect to my server on localhost

I running a RESTful api node server on my localhost and I can reach it on postman but I cant access to it on my react app and get this error when try to connect:我在我的本地主机上运行一个 RESTful api 节点服务器,我可以在 postman 上访问它,但我无法在我的 React 应用程序上访问它,并在尝试连接时出现此错误:

在此处输入图像描述

what is the problem?问题是什么?

There is some interesting information on restricted/unsafe ports on this post: https://superuser.com/questions/188058/which-ports-are-considered-unsafe-by-chrome这篇文章中有一些关于受限/不安全端口的有趣信息: https://superuser.com/questions/188058/which-ports-are-considered-unsafe-by-chrome

And an answer on how to turn this setting off in Windows on https://superuser.com/questions/188006/how-to-fix-err-unsafe-port-error-on-chrome-when-browsing-to-unsafe-ports以及关于如何在 Windows 中关闭此设置的答案https://superuser.com/questions/188006/how-to-fix-err-unsafe-port-error-on-chrome-when-browsing-to-unsafe -端口

Alternatively - change your exposed port to outside of the list on the first link.或者 - 将您的公开端口更改为第一个链接列表之外的端口。

6000 is considered an unsafe port by Chrome. 6000 被 Chrome 认为是不安全的端口。 Just make the port 3000 or something within safe range.只需将端口 3000 或其他设置在安全范围内即可。

Ref 参考

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM