github图片加载异常解决方案及总结 您所在的位置:网站首页 svn服务器修改地址后访问不到 github图片加载异常解决方案及总结

github图片加载异常解决方案及总结

2023-06-18 02:17| 来源: 网络整理| 查看: 265

github图片加载异常解决方案及总结 导语:

在github的日常使用中,我发现仓库中的一些图片常常无法正常显示。

(在其他网页出现同样情况是也可以参考本文)

打开页面检查(ctrl + shift + i)后发现工作台出现错误如下:

raw.githubusercontent.com/xxx/xxx/xxx/xxx/test.jpg:1 Failed to load resource: net::ERR_CONNECTION_REFUSED content_script.js:3810 Immersive Translate ERROR: translate page error Error A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received at P (content_script.js:3807:9432) 解决方案:

查询域名对应的真实 IP

将其追加到 hosts文件中(需要以管理员身份运行编辑器)

根据操作系统不同hosts文件所在位置也不同

Windows:C:\Windows\System32\drivers\etc\hostsmacOS:/private/etc/hosts 或 /etc/hostslinux:/etc/hosts

可在 https://www.ipaddress.com/ 查询 raw.githubusercontent.com 的真实 IP ;

以下为查询好的:

# GitHub Start 140.82.113.3 github.com 140.82.113.3 gist.github.com 185.199.108.153 assets-cdn.github.com 185.199.109.153 assets-cdn.github.com 185.199.110.153 assets-cdn.github.com 185.199.111.153 assets-cdn.github.com 185.199.108.153 raw.githubusercontent.com 185.199.109.153 raw.githubusercontent.com 185.199.110.153 raw.githubusercontent.com 185.199.111.153 raw.githubusercontent.com 185.199.108.133 gist.githubusercontent.com 185.199.109.133 gist.githubusercontent.com 185.199.110.133 gist.githubusercontent.com 185.199.111.133 gist.githubusercontent.com 185.199.108.133 cloud.githubusercontent.com 185.199.109.133 cloud.githubusercontent.com 185.199.110.133 cloud.githubusercontent.com 185.199.111.133 cloud.githubusercontent.com 185.199.108.133 camo.githubusercontent.com 185.199.109.133 camo.githubusercontent.com 185.199.110.133 camo.githubusercontent.com 185.199.111.133 camo.githubusercontent.com 185.199.108.133 avatars0.githubusercontent.com 185.199.108.133 avatars1.githubusercontent.com 185.199.108.133 avatars2.githubusercontent.com 185.199.108.133 avatars3.githubusercontent.com 185.199.108.133 avatars4.githubusercontent.com 185.199.108.133 avatars5.githubusercontent.com 185.199.108.133 avatars6.githubusercontent.com 185.199.108.133 avatars7.githubusercontent.com 185.199.108.133 avatars8.githubusercontent.com # GitHub End 总结: 以上问题和DNS污染有直接关系,DNS污染可能导致网页无法加载、无法连接到服务器或获取错误的IP地址等问题。解决DNS污染问题的有效方法:修改本地hosts文件

这种方法简单而有效,帮助绕过受污染的DNS服务器,确保顺利访问需要的网站。

补充: 1.什么是DNS污染?

DNS污染是指恶意的第三方篡改或修改DNS查询结果的行为。这可能导致 无法正常访问特定网站或服务,影响 的网络体验。

2.为什么要修改hosts文件?

修改本地的hosts文件可以覆盖DNS解析结果,确保 的计算机使用指定的IP地址来解析特定域名,而不是依赖受污染的DNS服务器。

3.修改本地hosts文件的步骤:

a. 以管理员身份运行文本编辑器(如记事本)。

b. 导航到hosts文件所在的文件夹位置(Windows:C:\Windows\System32\drivers\etc\,macOS:/private/etc/)。

c. 打开hosts文件。

d. 在文件末尾添加类似于 “IP地址 域名” 的条目,以覆盖相应域名的DNS解析结果。

e. 保存hosts文件并关闭文本编辑器。

f. 刷新DNS缓存,以确保更改生效。

4.示例:将 “example.com” 的DNS解析结果修改为 “123.456.789.0”。

123.456.789.0 example.com 添加其他需要修改的域名时,请遵循相同的格式。

5.注意事项: 修改hosts文件可能需要管理员权限,请以管理员身份运行文本编辑器。修改hosts文件仅适用于 的本地计算机,其他计算机或设备仍可能受到DNS污染的影响。如有必要,定期检查并更新hosts文件中的条目,以适应域名的IP地址变化。结论: 通过修改本地的hosts文件, 可以有效地解决DNS污染问题,确保顺利访问受影响的网站。这种方法简单而可靠,适用于个人计算机。然而,需要谨慎操作并了解所做更改的影响和潜在的安全风险。对于企业或大规模网络,可能需要采取其他高级的解决方案。如若遇到DNS污染问题,不妨尝试修改本地hosts文件,这可能是解决问题的有效方法之一。


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有