Post

@astro.build Is it possible to set up my own worker script similar to Remix `handleRequest()`? I want to set up custom SWR caching, but the only option is the Vite configuration with Cloudflare proxy plugin?

0 reposts1 like

```ts export default { async fetch(request, env, ctx) { try { return await handleRequest(request, env, ctx); } catch (ex) { return new Response('Internal server error', { status: 500 }); } }, } satisfies ExportedHandler<Env>; ```

It seems that no matter what I do, the middleware throws `Can't modify immutable headers.` while returning a cached response from Cloudflare, not Astro's `await next()`. I'll try to fill the issue.