語境
我嘗試HTTP/2通過我的 nginx 配置啟用:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name stg.grozissaviems.lt;
ssl_certificate /etc/nginx/certs/stg.grozissaviems.lt.crt;
ssl_certificate_key /etc/nginx/certs/stg.grozissaviems.lt.key;
ssl_protocols TLSv1.2;
}
問題
當我運行curl -I -L https://stg.grozissaviems.lt除錯時HTTP/2:
通過我的筆記本電腦終端(MacOS)我看到
HTTP/1.1 200 OK Server: nginx/1.21.1 Date: Mon, 26 Sep 2022 08:11:07 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Vary: Accept-Encoding X-Powered-By: PHP/8.0.23 Cache-Control: max-age=0, must-revalidate, private pragma: no-cache Expires: Mon, 26 Sep 2022 08:11:07 GMT Link: </build/fonts/Quicksand-Bold.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-Light.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-Medium.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-Regular.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-SemiBold.ttf>; rel="preload"; as="font" Strict-Transport-Security: max-age=31536000通過我的 VPS 終端(Ubuntu)我看到
HTTP/2 200 server: nginx/1.21.1 date: Mon, 26 Sep 2022 08:11:36 GMT content-type: text/html; charset=UTF-8 vary: Accept-Encoding x-powered-by: PHP/8.0.23 cache-control: max-age=0, must-revalidate, private pragma: no-cache expires: Mon, 26 Sep 2022 08:11:36 GMT link: </build/fonts/Quicksand-Bold.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-Light.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-Medium.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-Regular.ttf>; rel="preload"; as="font",</build/fonts/Quicksand-SemiBold.ttf>; rel="preload"; as="font" strict-transport-security: max-age=31536000
當我使用這個 KeyCDN 工具除錯它時,我看到:
支持 HTTP/2 協議。
支持 ALPN 擴展。
當我使用 Google Chrome 訪問該網站時,在“網路”選項卡中,我看到:
stg.grozissaviems.lt 200 http/1.1
流沙-Bold.ttf 200 http/1.1
為什么會有所不同?
uj5u.com熱心網友回復:
我終于找到了問題。根據這個答案:
您正在使用防病毒軟體,它是 MITM 您的流量,因此將您降級到 HTTP/1.1。...
我確實關閉了我的防病毒軟體,我終于可以HTTP/2在“網路”選項卡中看到了!
如果有人偶然發現我的問題并且打開防病毒軟體沒有幫助,請查看此答案以獲取更多解決方案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/512918.html
