链接a中国ip不能访问如何用caddy搭建一个网站b访问链接a同时欺骗浏览器访问的是a链接
如果链接a中国IP不能访问,可以考虑使用Caddy搭建一个反向代理来实现访问。以下是具体步骤:
1.首先,需要在Caddy上安装proxy插件,可以在Caddy的插件列表中找到并安装。
2.在Caddy的配置文件中添加反向代理的配置,如下所示:
example.com {
proxy / https://a.com {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Proto {scheme}
}
}
其中,example.com为你自己的域名或IP地址,https://a.com为需要访问的链接a。
3.保存配置文件后,重启Caddy服务。访问example.com时,就会被自动转发到链接a。
4.为了欺骗浏览器访问的是a链接,可以在Caddy的配置文件中添加伪造header的配置,如下所示:
example.com {
proxy / https://a.com {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Proto {scheme}
header_downstream -Server
header_downstream -X-Powered-By
header_downstream -Content-Security-Policy
header_downstream -Strict-Transport-Security
header_downstream -X-Content-Type-Options
header_downstream -X-XSS-Protection
header_downstream -X-Frame-Options
header_downstream -Referrer-Policy
header_downstream -Expect-CT
header_downstream -Feature-Policy
header_downstream -Permissions-Policy
header_downstream -Clear-Site-Data
header_downstream -Cross-Origin-Opener-Policy
header_downstream -Cross-Origin-Embedder-Policy
header_downstream X-Powered-By "PHP/5.6.30"
header_downstream Server "Apache/2.4.10 (Debian)"
}
}
其中,header_downstream用于伪造响应头,-Server、-X-Powered-By等用于删除原始响应头,X-Powered-By和Server可以任意修改为需要欺骗的内容。
5.保存配置文件后,重启Caddy服务。此时访问example.com时,浏览器会认为访问的是a链接,而不是被代理的b链接
原文地址: https://www.cveoy.top/t/topic/feMl 著作权归作者所有。请勿转载和采集!