https - create-react-app https localhost 安全连接失败

标签 https openssl create-react-app

我正在尝试在本地开发上使用 https 来创建“create-react-app”。 我使用此站点作为创建证书的教程并让 Windows 信任它: https://zeropointdevelopment.com/how-to-get-https-working-in-windows-10-localhost-dev-environment/

这是我的 .env 文件。

SSL_CRT_FILE=client-1.local.crt
SSL_KEY_FILE=client-1.local.key
HTTPS=true

这是我的 package.json

...
"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
...

之后,我使用

npm start

命令,然后转到 https://localhost:3000/

  • 在 Firefox 上我收到了

Secure Connection Failed" error with very few details "An error occurred during a connection to localhost:3000.PR_CONNECT_RESET_ERROR

  • 在 Chrome 上我收到

The connection was reset

我还检查了这篇文章create-react-app: how to use https instead of http?但我没有看到任何可以帮助我的东西。 我有 Windows 10。

有什么想法吗? 谢谢

最佳答案

我在 Edge 上也遇到了类似的问题。这就是我解决这个问题的方法,

  1. 在 Edge 浏览器中输入 URL:- edge://net-internals/#hsts
  2. 在“删除域安全策略”中输入“localhost”,然后按“删除”。
  3. 重新开放 localhost:3000/

*chrome也有类似的链接chrome://net-internals/#hsts

关于https - create-react-app https localhost 安全连接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65834614/

相关文章:

javascript - React 片段速记无法编译

java - Spring Security 3.1.0 - 无法从 HTTPS 切换到 HTTP

curl - 如何在 Go 中设置空授权 header ?

regex - 有没有办法只使用 3x 来解决几个 CloudFlare 'Page Rules'?

c++ - openssl 接受连接使用我的缓冲区

c++ - 使用来自 OpenSSL 的 EC_POINT_mul 的奇怪结果

emoji - 创建 React App jsx-a11y/accessible-emoji 警告不会消失

javascript - 创建 react 应用程序不在开发或构建中加载 css 背景图像

google-chrome - 编写 SSL 客户端和服务器 key

openssl - 如何使用 openssl 获取整个证书链的公钥