It is recommended to use regular expressions to filter requests for personal use, and set a custom domain name for the worker. It is forbidden to use the proxy for the entire site, such as GitHub. Otherwise, the official risk control will not be responsible for the account.
Theoretically, it supports proxying any blocked domain name. You only need to set the environment variable PROXY_HOSTNAME to the blocked domain name, and then access it through your worker custom domain name.
- Workers: Copy _worker.js, save and deploy on Cloudflare
- Pages: Fork the repository and connect GitHub on Cloudflare for quick deployment
Name | Required | Default | Example | Remark |
---|---|---|---|---|
PROXY_HOSTNAME | √ | github.com | Proxy address hostname | |
PROXY_PROTOCOL | × | https | https | Proxy address protocol |
PATHNAME_REGEX | × | ^/jonssonyan/ | Regular expression for proxy address path | |
UA_WHITELIST_REGEX | × | (curl) | Regular expression for User-Agent whitelist | |
UA_BLACKLIST_REGEX | × | (curl) | Regular expression for User-Agent blacklist | |
IP_WHITELIST_REGEX | × | (192.168.0.1) | Regular expression for IP whitelist | |
IP_BLACKLIST_REGEX | × | (192.168.0.1) | Regular expression for IP blacklist | |
REGION_WHITELIST_REGEX | × | (JP) | Regular expression for region whitelist | |
REGION_BLACKLIST_REGEX | × | (JP) | Regular expression for region blacklist | |
URL302 | × | https://github.com/jonssonyan/cf-workers-proxy | 302 Redirect address | |
DEBUG | × | false | false | Enable DEBUG |
- Set the environment variable PROXY_HOSTNAME to the mirror repository address.
Mirror repository | Address |
---|---|
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 |
-
Set up a Docker registry proxy
Replace https://dockerhub.xxx.com with your worker custom domain name
mkdir -p /etc/docker cat >/etc/docker/daemon.json <<EOF { "registry-mirrors":["https://dockerhub.xxx.com"] } EOF systemctl daemon-reload systemctl restart docker
you can contact me at YouTube: https://www.youtube.com/@jonssonyan
If this project is helpful to you, you can buy me a cup of coffee.