【问题标题】:Status 0, StatusText: Unknown Error, Name: HttpErrorResponse状态 0,StatusText:未知错误,名称:HttpErrorResponse
【发布时间】:2021-06-27 19:36:43
【问题描述】:

使用 VSC、Angular 11 和 node/Express API 进行本地主机开发,使用 OpenSSL 的自签名证书。我能够解决包括 Postman 和独立 Chrome 在内的所有问题,请参阅 my answer of this SO 中的详细信息,除非 Angular 调用 API https://localhost:3001/whatever 总是在 Title 中出现错误。 (邮递员和独立的 Chrome 工作)

F12,Network 显示这不是我在 Angular 和节点上的代码,而是证书。

我的launch.json:

"configurations": [
    {
        "name": "Attach to a running Chrome @4200",
        "type": "pwa-chrome",
        "request": "attach",
        "port": 9222,
        "urlFilter": "https://localhost:4200/*",
        "webRoot": "${workspaceFolder}"
    },
    {
        "type": "chrome",
        "request": "launch",
        "name": "F5 against localhost",
        "port": 4201,
        "url": "https://localhost:4200",
        "webRoot": "${workspaceFolder}"
    }
]

为什么我有两个条目?应用程序正在使用 3rd-party 身份验证,例如 Google。在弄清楚如何使用F5 进行调试之前,我总是收到“无法登录。您的浏览器不安全。试试……”。 Attachpwa-chrome 是我的解决方案。后来我发现在 F5 上使用旧版 Chrome。

VSC 关于:

Version: 1.57.1 (user setup)
Commit: 507ce72a4466fbb27b715c3722558bb15afa9f48
Date: 2021-06-17T13:28:07.755Z
Electron: 12.0.7
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19041

独立 Chrome 为 91.0.4472.114

【问题讨论】:

    标签: visual-studio-code ssl-certificate


    【解决方案1】:

    原来按 F5 调出的 Chrome 并没有独立设置的设置。所以,只需 chrome://flags/#allow-insecure-localhost 并启用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-29
      • 2019-06-25
      • 2013-10-24
      • 2021-05-25
      • 2021-05-14
      • 2011-10-24
      • 1970-01-01
      • 2019-04-03
      相关资源
      最近更新 更多