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;