From 67daf006d7a569d6b7aade2538f9384475890eed Mon Sep 17 00:00:00 2001 From: xiaokaixuan Date: Fri, 4 Aug 2023 17:03:50 +0800 Subject: [PATCH] Fix Bug --- cf-worker/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cf-worker/index.js b/cf-worker/index.js index 6de9fc98e..f294115ac 100644 --- a/cf-worker/index.js +++ b/cf-worker/index.js @@ -73,7 +73,7 @@ async function handleRequest(event) { // 发起 fetch let fr = (await fetch(url, fp)); outCt = fr.headers.get('content-type'); - if(outCt.includes('application/text') || outCt.includes('text/html')) { + if(outCt && (outCt.includes('application/text') || outCt.includes('text/html'))) { try { // 添加base let newFr = new HTMLRewriter() @@ -89,6 +89,9 @@ async function handleRequest(event) { } catch(e) { } } + for (const [key, value] of fr.headers.entries()) { + outHeaders.set(key, value); + } outStatus = fr.status; outStatusText = fr.statusText; outBody = fr.body;