File size: 704 Bytes
82371bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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);
  },
};