從其他機器訪問 webpack DevServer 子 URL 時出現 ERR_SSL_PROTOCOL_ERROR (ERR_SSL_PROTOCOL_ERROR when accessing webpack DevServer sub-URLs from a different machine)


問題描述

從其他機器訪問 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 端口 ‑ 我只是試圖從不同的端口提供應用程序):在此處輸入圖片描述 輸入圖片在此處描述” /></a></p> <p>可能是什麼問題?我花了幾個小時調試它,但沒有成功(我也嘗試了 DevServer 的 <code>‑disable‑host‑check</code> 參數,它沒有幫助)</p> <h2>更新:</h2> <p> 我嘗試使用 HTTP 而不是 HTTPS 為應用程序提供服務,但它在 Web 瀏覽器中也不起作用 ‑ 只是錯誤消息從 <code>ERR_SSL_PROTOCOL_ERROR</code> 更改為 <code>ERR_INVALID_HTTP_RESPONSE</code>。但 Wireshark 顯示獲取了一些數據 <a href=在此處輸入圖片描述 在此處輸入圖片描述

無法在 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 PaloDominik Palo)

參考文件

  1. ERR_SSL_PROTOCOL_ERROR when accessing webpack DevServer sub‑URLs from a different machine (CC BY‑SA 2.5/3.0/4.0)

#Webpack #Express #webpack-dev-server #HTTPS #SSL






相關問題

Babel 6 轉換運行時:$export 不是函數 (Babel 6 transform-runtime: $export is not a function)

Webpack 和 Sass 正確處理 background: url() 圖像,但是在與 webpack-dev-server 一起使用時找不到它 (Webpack and Sass correctly processes background: url() image but then it's not found when used with webpack-dev-server)

Babel 和 ES6 出現意外的“Uncaught TypeError: XXX is not a constructor”錯誤 (Unexpected "Uncaught TypeError: XXX is not a constructor" errors with Babel and ES6)

Webpack bundle ENOENT:沒有這樣的文件或目錄 fs.readdirSync (Webpack bundle ENOENT: no such file or directory fs.readdirSync)

有沒有辦法通過替換一些資產和組件從單個應用程序構建多個應用程序? (Is there a way to build multiple apps from single one with replacing some assets and components?)

Babel 7 不能正確轉換 index.js (Babel 7 don't convert index.js properly)

使用 Yarn 安裝的軟件包開始出現 sweetalert2 之類的錯誤 (packages installed with Yarn start to give error like sweetalert2)

找不到模塊 RecipeStyle.css (cannot find module RecipeStyle.css)

用於文件、子文件的 Webpack 加載器並將它們添加到跟踪列表 (Webpack loader for file, subfiles and add them to tracking list)

Webpack:沒有加載器來處理 SCSS 是輸入存在 (Webpack: no loader to handle the SCSS is input is present)

Webpack 在初始構建後不構建捆綁包 (Webpack not building bundle after initial build)

從其他機器訪問 webpack DevServer 子 URL 時出現 ERR_SSL_PROTOCOL_ERROR (ERR_SSL_PROTOCOL_ERROR when accessing webpack DevServer sub-URLs from a different machine)







留言討論