cf work免证书转发

admin
2022-04-30 / 0 评论 / 121 阅读 / 正在检测是否收录...

没啥解释的,看代码吧

addEventListener(
  'fetch',event => {
     let url=new URL(event.request.url);
     url.hostname='你的域名';
     if(url.protocol == 'https:') {
        url.protocol='http:'
     }
     let request=new Request(url,event.request);
     if(request.headers.has("Origin")) {
       request.headers.delete("Origin");
     }
     event.respondWith(
          fetch(request)
    )
  }
)
0

评论 (0)

取消