起因:
昨天我突然發現自己的Github上README的圖片怎麼看不到了。我還以爲是圖片文件出現問題了,就一波騷操作大換血,把對應的圖片全部衝重傳了一遍,還重新編輯了README,然而,並沒有什麼用。於是我突然意識到了什麼,難道網不好,那我睡一覺醒來再看。結果傻眼了,依然沒有好。
過程:
完蛋了,這下我急了,肯定出現了大問題,於是F12點進了控制檯,發現圖片都是獲取失敗了,並爆出如下提示:
Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID
結果:
於是網上各種搜。終於找到了原因和解決方法:
原因:
實際上,可以認爲,ERR_CERT_COMMON_NAME_INVALID就是用一個錯誤的域名訪問了某個節點的https資源。導致這個錯誤的原因,基本是:
1.dns污染
2.host設置錯誤
3.官方更新了dns,但是dns緩存沒有被更新,導致錯誤解析。
What,我的dns可能不乾淨了。我得淨化淨化它~~~
解決方案:
1.得到出現問題的圖片的地址
https://raw.githubusercontent.com/Mbabysbreath/FileSearch/master/maven_test/display/%E5%85%B3%E9%94%AE%E5%AD%97%E6%90%9C%E7%B4%A2.png
2.取出它的二級域名
即:
raw.githubusercontent.com
3.打開域名解析網站 https://www.ipaddress.com/
4.輸入域名,得到一個ip地址
5.打開本機hosts文件,將域名和ip地址依次添加
C:\Windows\System32\drivers\etc\hosts
查找ip地址是件麻煩的事情,所以我這裏已經準備好了目前最新的ip,可以直接進行粘貼複製,但之後可能還會發生變化,大家就可以按照上述方法進行操作。
日期:2020/05/05
# GitHub Start
140.82.114.3 github.com
140.82.114.4 gist.github.com
185.199.108.153 assets-cdn.github.com
199.232.68.133 raw.githubusercontent.com
199.232.68.133 gist.githubusercontent.com
199.232.68.133 cloud.githubusercontent.com
199.232.68.133 camo.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
199.232.68.133 avatars6.githubusercontent.com
199.232.68.133 avatars7.githubusercontent.com
199.232.68.133 avatars8.githubusercontent.com
# GitHub End
6.完成後,保存退出
7.查看Github圖片是否可以加載
8.如果還不行嘗試刷新本地DNS緩存
ipconfig/flush
9.還可以清除瀏覽器緩存再試一下
後記:
總之,一番搗鼓後,我的圖片又回來了,真好,biubiu~~
參考文章:
https://blog.csdn.net/qq_38232598/article/details/91346392?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1