From ee8c0b50d5d88f5d0d3859c1f036bde7aabbfd48 Mon Sep 17 00:00:00 2001 From: "every.channel" Date: Tue, 24 Feb 2026 03:32:19 -0800 Subject: [PATCH] worker: proxy /archive paths to replay origin --- deploy/cloudflare-worker/src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deploy/cloudflare-worker/src/index.ts b/deploy/cloudflare-worker/src/index.ts index be176fc..725a652 100644 --- a/deploy/cloudflare-worker/src/index.ts +++ b/deploy/cloudflare-worker/src/index.ts @@ -108,7 +108,7 @@ export default { // Archive replay proxy. Forwards website requests to an archive replay origin // (typically forge running `ec-node wt-archive-serve`). - if (url.pathname.startsWith("/api/archive/")) { + if (url.pathname.startsWith("/api/archive/") || url.pathname.startsWith("/archive/")) { const origin = env.EC_ARCHIVE_ORIGIN?.trim(); if (!origin) { return jsonNoStore({ error: "archive origin not configured" }, { status: 503 }); @@ -120,7 +120,9 @@ export default { return jsonNoStore({ error: "invalid archive origin" }, { status: 500 }); } const target = new URL(base.toString()); - const suffix = url.pathname.slice("/api/archive".length); + const suffix = url.pathname.startsWith("/api/archive/") + ? url.pathname.slice("/api/archive".length) + : url.pathname.slice("/archive".length); target.pathname = `${base.pathname.replace(/\/$/, "")}/archive${suffix}`; target.search = url.search;