diff --git a/docs/lib/worker.test.ts b/docs/lib/worker.test.ts index 3bf09022cb..270731eb41 100644 --- a/docs/lib/worker.test.ts +++ b/docs/lib/worker.test.ts @@ -1,7 +1,19 @@ import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; import { test } from "vitest"; import { issueRedirectPath, pluginDetailShellRequest, sanitizeReturnTo, signPayload, staticAssetCacheControl, verifySignedPayload } from "../worker"; +test("plugin detail shell routes are routed to the worker before static 404 handling", () => { + const wrangler = JSON.parse(readFileSync(new URL("../wrangler.json", import.meta.url), "utf8")); + const runWorkerFirst: string[] = wrangler.assets.run_worker_first; + for (const prefix of ["/cn/plugins", "/en/plugins"]) { + assert.ok( + runWorkerFirst.includes(`${prefix}/*`), + `${prefix}/* missing from run_worker_first; the asset layer would serve the static 404 before the worker shell fallback runs`, + ); + } +}); + test("signed OAuth payloads round-trip and reject tampering", async () => { const signed = await signPayload({ login: "dbx-user" }, "test-secret"); assert.deepEqual(await verifySignedPayload<{ login: string }>(signed, "test-secret"), { login: "dbx-user" }); diff --git a/docs/wrangler.json b/docs/wrangler.json index 7727b9eb0e..3566b0441e 100644 --- a/docs/wrangler.json +++ b/docs/wrangler.json @@ -8,6 +8,8 @@ "not_found_handling": "404-page", "run_worker_first": [ "/api/*", + "/cn/plugins/*", + "/en/plugins/*", "/tr", "/tr/*", "/issue",