在將服務嘗試著從http協議往https協議遷移成功之后,又出于測試調試的目的將服務轉回到http協議,卻發(fā)現在瀏覽器輸入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.
查閱相關資料,發(fā)現這是瀏覽器的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即可(極少數情況下,可能需要重啟系統(tǒng))。
Firefox瀏覽器
1.關閉所有已打開的頁面。
2.清空歷史記錄和緩存。
3.地址欄輸入about:permissions。
4.搜索項目域名,并點擊Forget About This Site。
ps:下面看下解決谷歌瀏覽器http鏈接自動跳轉到https的問題
有些網址http協議和https協議是兩個服務,有時候需要訪問http地址,但chrome會默認轉成https請求地址,
輸入 http://baidu.com 會自動跳轉到 https://baidu.com
這時候清理瀏覽器緩存之類的都是沒有用的,需要進行如下操作,
在chrome瀏覽器地址輸入:chrome://net-internals/#hsts
![](/d/20211017/7f34b0c19e2f7e75f65f4506a4a60a8b.gif)
在最下面的Delete domain security policies
里輸入想要刪除的網址,注意是去掉http://前綴的網址,如:h5.baidu.com
到此這篇關于瀏覽器輸入http被自動跳轉至https問題的文章就介紹到這了,更多相關http自動跳轉至https內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
您可能感興趣的文章:- IIS7 IIS8 http自動跳轉到HTTPS(80端口跳轉443端口)
- Apache由http自動跳轉到https的多種方法
- Tomcat配置https并訪問http自動跳轉至https
- http自動跳轉https的配置方法