Upgrade-Insecure-Requests header

Baseline 已廣泛支援

此功能已成熟,可跨多種裝置和瀏覽器版本工作。它自 ⁨2018 年 4 月⁩ 起已在所有瀏覽器中可用。

HTTP Upgrade-Insecure-Requests 請求頭向伺服器傳送訊號,表明客戶端傾向於加密和認證的響應,並且客戶端可以成功處理upgrade-insecure-requests CSP 指令。

頭型別 請求頭
禁止請求頭

語法

http
Upgrade-Insecure-Requests: <boolean>

指令

<boolean>

1 表示“真”,是此欄位的唯一有效值。

示例

使用 Upgrade-Insecure-Requests

客戶端的請求向伺服器發出訊號,表明它支援 upgrade-insecure-requests 的升級機制

http
GET / HTTP/1.1
Host: example.com
Upgrade-Insecure-Requests: 1

伺服器現在可以重定向到網站的安全版本。可以使用 Vary 頭,這樣網站就不會透過快取提供給不支援升級機制的客戶端。

http
Location: https://example.com/
Vary: Upgrade-Insecure-Requests

規範

規範
升級不安全請求
# 偏好

瀏覽器相容性

另見