效果
反代前, 访问 https://zelikk.blogspot.com/1.html
得到
<html>
<body>
<a href="https://zelikk.blogspot.com/2.html">Page2</a>
<img src="https://blogger.googleusercontent.com/3.jpg">
</body>
</html>
反代后, 访问 https://one.eu.org/1.html
得到
<html>
<body>
<a href="https://one.eu.org/2.html">Page2</a>
<img src="https://img.one.eu.org/https://blogger.googleusercontent.com/3.jpg">
</body>
</html>
思路
用1个worker反代图片 用成熟的uniporxy项目
用1个worker反代html (即本项目)
并对html内容进行替换
项目
部署方法
示例,
想反代的域名是 zelikk.blogspot.com
镜像站的主域名是 one.eu.org 并且已经添加到 cloudflare
那么, 步骤如下:
域名 one.eu.org 设置自动TLS
建第1个worker
名称 例如, blogimg
自定义域名 img.one.eu.org
代码 使用成熟的uniporxy项目
建第2个worker
名称 例如, bloghtml
自定义域名 one.eu.org
代码 使用本项目的worker.js
代码开头的部分, 设置一些参数
部署完成
你可以用浏览器访问镜像站 https://one.eu.org 了
如果你想屏蔽部分path
就是说有一些原网站的页面, 你不希望在镜像站展示.
建1个KV
名称 例如, bloghtml_blocklist
添加
key = 你不想显示的path 如 /2023/06/racknerd-xray-reality.html
value = block
绑定KV
bloghtml worker 绑定KV
name KV_BLOCKLIST (不要改动)
value bloghtml_blocklist (就是前面步骤中建立的KV名字)
如果你觉得要一条一条的添加需要屏蔽的path太麻烦了. 如果你有自定义博文链接的习惯的话. 你还可以根据path中的关键字来进行屏蔽.
根据关键字屏蔽path
修改bloghtml worker的代码
数组 BLOCK_KEYWORDS 中添加你想屏蔽的path关键字.
我项目中的逻辑是, 根据path中的关键字来判断是否屏蔽. 如果你觉得需要根据html整个内容进行关键字屏蔽, 问问GPT, 修改方案应该很容易.




