Software usage: Solve the problem of failure to display pictures on Github web pages.

Several weeks ago, I found out that I could githubn't display pictures when opening the webpage, but I didn't care about it at the time.

Today, the obsessive-compulsive disorder forced me to fix it, so I went to find some methods and made a record by myself. Partners with the same problem can refer to it.

problem

For example, I just open a project, the picture can't be displayed, and my avatar is gone. It's a sad thing.
Insert picture description here
F12Open the console and look at it. A
Insert picture description here
bunch of red ×s. The main error isFailed to load resource: net::ERR_CERT_COMMON_NAME_INVALID

I checked it, blogger john-zeng explained:

In fact, it can be considered that ERR_CERT_COMMON_NAME_INVALIDthe httpsresource of a certain node is accessed with a wrong domain name . The reasons for this error are basically:

  1. dns pollution
  2. host setting error
  3. The dns was officially updated, but the dns cache was not updated, resulting in incorrect resolution.

I think it seems a bit reasonable, the solution is rough, hin is simple, look down.

Solution

The main idea is to use local hostsfiles to resolve the domain name of the website. General DNSproblems can be solved by modifying the hostsfile. The problem githubof CDNcontaminated domain name is no exception. It can also be solved by modifying the hostsfile. The domain name resolution can be directly pointed to the IPaddress to bypass DNSthe resolution. , In order to solve the pollution problem.

Find URL

Open githubany webpage that does not display pictures, use the element selector ( Ctrl+Shift+C) to place on the picture that cannot be displayed, or right-click on the picture that cannot be displayed-check the element, locate the label of the picture, then you get its URL, called srcAttributes.

For example, Insert picture description here
please copy its URL on the right:

https://avatars2.githubusercontent.com/u/15832957?s=60&v=4

Get IP address

After obtaining the URL to open IPAddress.com this website, enter its domain name in the search box, that is, https://to comthat part, commonly known as second-level domain:

avatars2.githubusercontent.com
Insert picture description here
Enter! ! ! Below you will see a message and the domain name IPaddress:
Insert picture description here
we can see IP is: 151.101.184.133and is 2019.05.05 last updated, alright, then we can make this IP and domain name mapping them.

(If there are other hanging pictures, use this method for one-to-one mapping.)

Modify hosts

How to map specifically? Modify the hostsfile! ! ! I am using the windowssystem, so use to Sublime Textopen:C:\Windows\System32\drivers\etc\hosts

Add at the end of the file:
Insert picture description here

You can directly select the following content to copy and paste, update 20200328

# GitHub Start 
140.82.113.3      github.com
140.82.114.20     gist.github.com

151.101.184.133    assets-cdn.github.com
151.101.184.133    raw.githubusercontent.com
151.101.184.133    gist.githubusercontent.com
151.101.184.133    cloud.githubusercontent.com
151.101.184.133    camo.githubusercontent.com
151.101.184.133    avatars0.githubusercontent.com
199.232.68.133     avatars0.githubusercontent.com
199.232.28.133     avatars1.githubusercontent.com
151.101.184.133    avatars1.githubusercontent.com
151.101.184.133    avatars2.githubusercontent.com
199.232.28.133     avatars2.githubusercontent.com
151.101.184.133    avatars3.githubusercontent.com
199.232.68.133     avatars3.githubusercontent.com
151.101.184.133    avatars4.githubusercontent.com
199.232.68.133     avatars4.githubusercontent.com
151.101.184.133    avatars5.githubusercontent.com
199.232.68.133     avatars5.githubusercontent.com
151.101.184.133    avatars6.githubusercontent.com
199.232.68.133     avatars6.githubusercontent.com
151.101.184.133    avatars7.githubusercontent.com
199.232.68.133     avatars7.githubusercontent.com
151.101.184.133    avatars8.githubusercontent.com
199.232.68.133     avatars8.githubusercontent.com

# GitHub End

Then save the file and it is OK. As for the file cannot be saved, there is no modification authority, right click the mouse-Properties-Security-Modify authority; or hostscopy the file, after modification, copy to the original folder and replace!

A few last words

You can also use ipconfig/flushto refresh the local DNS cache. If you encounter a network abnormality, it may be a problem with the DNS cache. Refresh, step by step.

  1. windows start→run→input: CMD Press Enter to open the command prompt window.
  2. Then enter: ipconfig /flushdns Press Enter, execute the command, you can rebuild the local DNS cache.

Attach a few more commands:

ipconfig /displaydns # 显示dns缓存 

ipconfig /flushdns # 刷新DNS记录 

ipconfig /renew # 重请从DHCP服务器获得IP 

PS: Another thing to note is that if the picture cannot be displayed again, you only need to update the IP in time. This wave of operation is not troublesome, you see my profile picture is back! ! !
JevenM

Guess you like

Origin blog.csdn.net/en_joker/article/details/107999658