求修一个反代Pandora的代码

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  const token = '你的token,测试token在本站找'; // 在这里填写你的 access token
  const url = new URL(request.url);
  const apiUrl = 'https://new.oaifree.com' + url.pathname + url.search;

  // 构建新的请求
  const newRequest = new Request(apiUrl, {
    method: request.method,
    headers: new Headers(request.headers),
  });

  // 在新请求中添加 Cookie
  newRequest.headers.set('cookie', `access-token=${token}`);

  // 向目标服务器发送请求
  const response = await fetch(newRequest);

  // 返回从目标服务器接收到的响应
  return response;
}

反代demo可以,为什么next不行

1 Like

常规话题快问快答

1 Like

new我没做完,也没在论坛公开。

3 Likes

快问快答常规话题

常规话题快问快答

1 Like

From #develop:qa to 开发调优

1 Like