cURL:绕过Cloudflare,通过IP直接访问托管在shared hosting上的网站

WARNING: This article may be obsolete
This post was published in 2021-01-06. Obviously, expired content is less useful to users if it has already pasted its expiration date.

适用情形:

  • 网站被托管在shared hosting里,没有独立IP
  • 网站使用Cloudflare进行加速,但出于某些原因,现在需要绕过Cloudflare直接访问
  • 无法通过 curl http://127.0.0.1:xxx/ 访问,无法通过 curl http://内网IP:xxx/ 访问
$ curl --header 'Host:yourDomain.com' http://公网IP:80/

(这条命令或者对应的程序最好在shared hosting本机上运行,否则还不如使用域名访问。)

用途举例:绕过Cloudflare,让缓存相关的preload更加稳定高效。


Reference:

How to access site through IP address when website is on a shared host?


 Last Modified in 2021-02-26 

Leave a Comment Anonymous comment is allowed / 允许匿名评论