From 72f900df23adc8fbc851633989f78d685a8f10be Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Wed, 22 Apr 2026 18:32:14 +0200 Subject: [PATCH] fix routing --- .cloudflare/docs-proxy/src/worker.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.cloudflare/docs-proxy/src/worker.js b/.cloudflare/docs-proxy/src/worker.js index 1a7b429c61d058133cb54a084ad05f48992e615c..08b0265fafbbb0f82dd6e22cc6ca4349a125fc43 100644 --- a/.cloudflare/docs-proxy/src/worker.js +++ b/.cloudflare/docs-proxy/src/worker.js @@ -2,15 +2,18 @@ export default { async fetch(request, _env, _ctx) { const url = new URL(request.url); - if (url.pathname === "/docs/nightly" || url.pathname.startsWith("/docs/nightly/")) { + if (url.pathname === "/docs/nightly") { url.hostname = "docs-nightly.pages.dev"; - url.pathname = url.pathname.replace("/docs/nightly", "/docs"); - } else if ( - url.pathname === "/docs/preview" || - url.pathname.startsWith("/docs/preview/") - ) { + url.pathname = "/docs/"; + } else if (url.pathname.startsWith("/docs/nightly/")) { + url.hostname = "docs-nightly.pages.dev"; + url.pathname = url.pathname.replace("/docs/nightly/", "/docs/"); + } else if (url.pathname === "/docs/preview") { + url.hostname = "docs-preview-5xd.pages.dev"; + url.pathname = "/docs/"; + } else if (url.pathname.startsWith("/docs/preview/")) { url.hostname = "docs-preview-5xd.pages.dev"; - url.pathname = url.pathname.replace("/docs/preview", "/docs"); + url.pathname = url.pathname.replace("/docs/preview/", "/docs/"); } else { url.hostname = "docs-anw.pages.dev"; }