From 291f504f9be4a65d2daa39a954a41bd8088561f3 Mon Sep 17 00:00:00 2001 From: xyTom <75466119+xyTom@users.noreply.github.com> Date: Sun, 15 May 2022 20:17:19 +0800 Subject: [PATCH] init --- _worker.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 _worker.js diff --git a/_worker.js b/_worker.js new file mode 100644 index 0000000..2d36b98 --- /dev/null +++ b/_worker.js @@ -0,0 +1,12 @@ +export default { + async fetch(request, env) { + let url = new URL(request.url); + if (url.pathname.startsWith('/')) { + url.hostname="example.com"; + let new_request=new Request(url,request); + return fetch(new_request); + } + // Otherwise, serve the static assets. + return env.ASSETS.fetch(request); + } + }; \ No newline at end of file