From c5dae61a506286b79eabbdcbbbcb9ff417be80e7 Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Mon, 3 Jun 2024 15:37:06 +0800 Subject: [PATCH] deploy --- public/functions/_worker.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 public/functions/_worker.js diff --git a/public/functions/_worker.js b/public/functions/_worker.js new file mode 100644 index 0000000..475253c --- /dev/null +++ b/public/functions/_worker.js @@ -0,0 +1,14 @@ +export default { + async fetch(request, env) { + const url = new URL(request.url) + + // 重定向到子站点 + if (url.pathname.startsWith('/pro-example')) { + url.hostname = 'fantastic-mobile-pro-example.pages.dev' + return fetch(url.toString(), request) + } + + // 其他路径处理 + return env.ASSETS.fetch(request) + }, +}