From 8f6702fd1888d2c2cd30d95a3eeec80a451a24c3 Mon Sep 17 00:00:00 2001 From: Harry-zklcdc Date: Thu, 18 Jan 2024 14:50:33 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=20=F0=9F=90=9B=20Cloudflare=20Deploy=20Ba?= =?UTF-8?q?seURL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloudflare/worker.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cloudflare/worker.js b/cloudflare/worker.js index 4147241994..3d186a7c54 100644 --- a/cloudflare/worker.js +++ b/cloudflare/worker.js @@ -169,8 +169,15 @@ const home = async (pathname) => { let url; if (pathname.indexOf('/web/') === 0) { url = pathname.replace('/web/', baseUrl+'web/'); + if (pathname == '/web/') { + url += 'index.html'; + } } else { - url = baseUrl + 'web/index.html'; + let res = new Response('', { + status: 302, + }); + res.headers.set("location", "/web/"); + return res; } const res = await fetch(url); const result = await rewriteBody(res);