没啥解释的,看代码吧
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)