diff --git a/tests/unit/wrangler-rate-limit-config.test.ts b/tests/unit/wrangler-rate-limit-config.test.ts index d4771f8da..1becd28b5 100644 --- a/tests/unit/wrangler-rate-limit-config.test.ts +++ b/tests/unit/wrangler-rate-limit-config.test.ts @@ -17,6 +17,27 @@ async function readRateLimits(fileName: string): Promise { } describe("Wrangler mutation rate-limit bindings", () => { + it.each([ + "wrangler.jsonc", + "wrangler.e2e.jsonc", + ])("routes application requests through the gateway while keeping static assets direct in %s", async (fileName) => { + const source = await readFile( + new URL(`../../${fileName}`, import.meta.url), + "utf8", + ); + const config = JSON.parse(source) as { + assets?: { run_worker_first?: string[] }; + }; + + expect(config.assets?.run_worker_first).toEqual([ + "/*", + "!/_app/*", + "!/images/*", + "!/static/*", + "!/openapi.generated.json", + ]); + }); + it("keeps public workers.dev and automatic request metadata logs disabled", async () => { const source = await readFile( new URL("../../wrangler.jsonc", import.meta.url), diff --git a/wrangler.e2e.jsonc b/wrangler.e2e.jsonc index da2b08473..dbcdc80e9 100644 --- a/wrangler.e2e.jsonc +++ b/wrangler.e2e.jsonc @@ -29,7 +29,14 @@ }, "assets": { "directory": ".svelte-kit/cloudflare", - "binding": "ASSETS" + "binding": "ASSETS", + "run_worker_first": [ + "/*", + "!/_app/*", + "!/images/*", + "!/static/*", + "!/openapi.generated.json" + ] }, "observability": { "enabled": false diff --git a/wrangler.jsonc b/wrangler.jsonc index f1ad79c30..60e2ebbc6 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -21,7 +21,14 @@ }, "assets": { "directory": ".svelte-kit/cloudflare", - "binding": "ASSETS" + "binding": "ASSETS", + "run_worker_first": [ + "/*", + "!/_app/*", + "!/images/*", + "!/static/*", + "!/openapi.generated.json" + ] }, "observability": { "enabled": true,