Download scripts/cloudflare-worker-web.js from binhugg4/web: direct link, hf CLI and curl.
- Browser
- Download file 704 Bytes
-
https://huggingface.co/spaces/binhugg4/web/resolve/main/scripts/cloudflare-worker-web.js
- Command line
-
hf download hf://spaces/binhugg4/web/scripts/cloudflare-worker-web.js
-
curl -L -o cloudflare-worker-web.js https://huggingface.co/spaces/binhugg4/web/resolve/main/scripts/cloudflare-worker-web.js
704 Bytes
| // Cloudflare Worker - Web 前端反向代理 | |
| // 目标:www.hanbin666.top → binhugg4-web.hf.space | |
| // 部署方式:Cloudflare Dashboard → Workers & Pages → Create Worker → 粘贴此代码 | |
| // 路由绑定:www.hanbin666.top/* 或 hanbin666.top/* | |
| export default { | |
| async fetch(request) { | |
| const url = new URL(request.url); | |
| url.hostname = "binhugg4-web.hf.space"; | |
| url.port = "443"; | |
| url.protocol = "https:"; | |
| const newRequest = new Request(url.toString(), { | |
| method: request.method, | |
| headers: request.headers, | |
| body: ["GET", "HEAD"].includes(request.method) ? undefined : request.body, | |
| redirect: "follow", | |
| }); | |
| return fetch(newRequest); | |
| }, | |
| }; | |