Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonssonyan/cf-workers-proxy
Cloudflare Workers HTTP 反向代理
https://github.com/jonssonyan/cf-workers-proxy
cloudflare http proxy
Last synced: 3 months ago
JSON representation
Cloudflare Workers HTTP 反向代理
- Host: GitHub
- URL: https://github.com/jonssonyan/cf-workers-proxy
- Owner: jonssonyan
- License: gpl-3.0
- Created: 2024-07-26T19:12:15.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-31T01:45:11.000Z (5 months ago)
- Last Synced: 2024-07-31T04:28:05.690Z (5 months ago)
- Topics: cloudflare, http, proxy
- Language: JavaScript
- Homepage:
- Size: 76.2 KB
- Stars: 28
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cloudflare - cf-workers-proxy
README
**建议自用,使用正则表达式过滤请求,并设置 worker 自定义域名,禁止代理全站,例如:GitHub,否则导致账号被官方风控概不负责**
理论上支持代理任何被屏蔽的域名,只需要设置环境变量 PROXY_HOSTNAME 为被屏蔽的域名,最后通过你的 worker 自定义域名访问即可
## 部署
- Workers 方式: 复制 [_worker.js](_worker.js) ,在 [Cloudflare](https://www.cloudflare.com) 保存并部署
- Pages 方式: [Fork](https://github.com/jonssonyan/cf-workers-proxy/fork) 仓库,在 [Cloudflare](https://www.cloudflare.com) 连接 GitHub 一键部署## 环境变量
| 变量名 | 必填 | 默认值 | 示例 | 备注 |
|------------------------|-----|-------|------------------------------------------------|---------------------|
| PROXY_HOSTNAME | √ | | github.com | 代理地址 hostname |
| PROXY_PROTOCOL | × | https | https | 代理地址协议 |
| PATHNAME_REGEX | × | | ^/jonssonyan/ | 代理地址路径正则表达式 |
| UA_WHITELIST_REGEX | × | | (curl) | User-Agent 白名单正则表达式 |
| UA_BLACKLIST_REGEX | × | | (curl) | User-Agent 黑名单正则表达式 |
| IP_WHITELIST_REGEX | × | | (192.168.0.1) | IP 白名单正则表达式 |
| IP_BLACKLIST_REGEX | × | | (192.168.0.1) | IP 黑名单正则表达式 |
| REGION_WHITELIST_REGEX | × | | (JP) | 地区白名单正则表达式 |
| REGION_BLACKLIST_REGEX | × | | (JP) | 地区黑名单正则表达式 |
| URL302 | × | | https://github.com/jonssonyan/cf-workers-proxy | 302 跳转地址 |
| DEBUG | × | false | false | 开启调试 |## 镜像仓库加速
1. 将环境变量 PROXY_HOSTNAME 设置为以镜像仓库地址即可
| 镜像仓库 | 地址 |
|------------|----------------------|
| docker | registry-1.docker.io |
| k8s-gcr | k8s.gcr.io |
| k8s | registry.k8s.io |
| quay | quay.io |
| gcr | gcr.io |
| ghcr | ghcr.io |
| cloudsmith | docker.cloudsmith.io |
| ecr | public.ecr.aws |2. 设置 Docker 镜像仓库加速
将 https://dockerhub.xxx.com 替换为你的 worker 自定义域名
```bash
mkdir -p /etc/docker
cat >/etc/docker/daemon.json <## 开源协议
[GPL-3.0](LICENSE)