問題描述
從其他機器訪問 webpack DevServer 子 URL 時出現 ERR_SSL_PROTOCOL_ERROR (ERR_SSL_PROTOCOL_ERROR when accessing webpack DevServer sub‑URLs from a different machine)
我正在嘗試從虛擬機訪問使用 webpack DevServer 提供的 Web 應用程序,但我只能通過 HTTPS 連接到主 URL ‑ 所有子 URL 都因 ERR_SSL_PROTOCOL_ERROR
錯誤。
這是我的設置:
我正在使用 macOS 的主機上運行 webpack DevServer。我的虛擬機正在運行 Windows 10(橋接網絡模式下的 VMware Fusion)。Webpack DevServer 使用自定義的自簽名 SSL 證書(使用 mkcert
工俱生成 ).
這是我的 DevServer 配置 (@angular‑builders/custom‑webpack:dev‑server
):
"builder": "@angular‑builders/custom‑webpack:dev‑server",
"options": {
"browserTarget": "admin:build",
"allowedHosts": [
"localhost",
"admin.local.slido‑staging.com"
],
"host": "0.0.0.0",
"port": 443,
"servePath": "/",
"ssl": true,
"sslCert": "ssl/server.crt",
"sslKey": "ssl/server.key"
},
( local.slido‑staging.com
只是一個“DNS 別名”;對於localhost
由於內部需求,所以也為*.local.slido‑staging.com
生成開發證書)。
Web 應用程序也可通過 HTTPS 從虛擬機訪問,我已從主機導出根證書頒發機構(由 mkcert
生成),將其導入到 VM Windows 機器上的根證書頒發機構存儲中,然後將 192.168.2.90 admin.local.slido‑staging.com
添加到我的 Windows hosts
文件(192.168.2.90 是我的主機的 IP 地址)。
問題:
但嘗試通過主機名訪問它失敗(忽略最後一個屏幕截圖上的 4443 端口 ‑ 我只是試圖從不同的端口提供應用程序):
無法在 Web 瀏覽器中工作 ‑ 只是錯誤消息從ERR_SSL_PROTOCOL_ERROR
更改為 ERR_INVALID_HTTP_RESPONSE
。但 Wireshark 顯示獲取了一些數據 無法在 Web 瀏覽器中工作 ‑ 只是錯誤消息從 ERR_SSL_PROTOCOL_ERROR
更改為 ERR_INVALID_HTTP_RESPONSE
。但 Wireshark 顯示獲取了一些數據 參考解法
方法 1:
The issue was caused by the latest version of Cisco AnyConnect Secure Mobility Client (4.10) installed on the host computer. After downgrading Cisco AnyConnect software to version 4.9 everything works as expected.
(by Dominik Palo、Dominik Palo)