在安裝配置 SSL 證書時,可以使用一種能使數據傳輸更加安全的Web安全協議,即在服務器端上開啟 HSTS
(HTTP Strict Transport Security)。它告訴瀏覽器只能通過HTTPS訪問,而絕對禁止HTTP方式。
HTTP Strict Transport Security (HSTS) is an opt-in security enhancement that is specified by a web application through the use of a special response header. Once a supported browser receives this header that browser will prevent any communications from being sent over HTTP to the specified domain and will instead send all communications over HTTPS. It also prevents HTTPS click through prompts on browsers.
但是,在日常開發的過程中,有時我們會想測試頁面在 HTTP 連接中的表現情況,這時 HSTS 的存在會讓調試不能方便的進行下去。而且由於 HSTS 並不是像 cookie 一樣存放在瀏覽器緩存里,簡單的清空瀏覽器緩存操作並沒有什么效果,頁面依然通過 HTTPS 的方式傳輸。 那么怎樣才能關閉瀏覽器的 HSTS 呢,各種谷歌
之后,在這里匯總一下幾大常見瀏覽器 HSTS 的關閉方法。
Safari 瀏覽器
- 完全關閉 Safari
- 刪除
~/Library/Cookies/HSTS.plist
這個文件 - 重新打開 Safari 即可
- 極少數情況下,需要重啟系統
Chrome 瀏覽器
- 地址欄中輸入
chrome://net-internals/#hsts
- 在
Delete domain
中輸入項目的域名,並Delete
刪除 - 可以在
Query domain
測試是否刪除成功
Opera 瀏覽器
和 Chrome 方法一樣
Firefox 瀏覽器
- 關閉所有已打開的頁面
- 清空歷史記錄和緩存
- 地址欄輸入
about:permissions
- 搜索項目域名,並點擊
Forget About This Site
內容轉自:http://www.tuicool.com/articles/QbYBne