瀏覽器輸入http被自動跳轉至https問題


在將服務嘗試着從http協議往https協議遷移成功之后,又出於測試調試的目的將服務轉回到http協議,卻發現在瀏覽器輸入http會被自動跳轉到https。

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.

查閱相關資料,發現這是瀏覽器的HSTS(HTTP Strict Transport Security)功能引起的。在安裝配置SSL證書時,可以使用一種能使數據傳輸更加安全的Web安全協議,即在服務器端上開啟HSTS ,它會告訴瀏覽器只能通過HTTPS訪問,而絕對禁止HTTP方式。

因此,只要關閉瀏覽器的HSTS功能就可以解決這個問題,但是只能通過特定的方式,而不是清除瀏覽器緩存那么簡單。

Chrome瀏覽器

1.地址欄中輸入chrome://net-internals/#hsts。

2.在Delete domain中輸入項目的域名,並Delete(刪除)

3.可以在Query domain測試是否刪除成功。

Opera瀏覽器

和Chrome方法一樣。

Safari瀏覽器

1.完全關閉Safari瀏覽器。

2.刪除~/Library/Cookies/HSTS.plist這個文件。

3.重新打開Safari即可(極少數情況下,可能需要重啟系統)。

Firefox瀏覽器

1.關閉所有已打開的頁面。

2.清空歷史記錄和緩存。

3.地址欄輸入about:permissions。

4.搜索項目域名,並點擊Forget About This Site。

 

"耗盡半生做爛泥,連哭都覺得失禮。"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM