This is because it provisions a certificate for every new Pages project.
This is because it provisions a certificate for every new Pages project.
export async function onRequest(context) and uses the value? Does is always act like a middleware? Would I need to route this manually like in https://developers.cloudflare.com/pages/platform/functions/examples/ab-testing/ ?_routes.json , even when using advanced mode (_worker.js), you do not need to serve static assets using env.ASSETS.fetch -- it's done for you.onRequest syntax is specific to Functions file-based routing, so whilst you could have a middleware that does routing based on the request URL, you'd rather do functions/foo.ts and functions/bar.ts.next() just falls through to the asset server if it isn't a middleware.

__dirname is not usable on pages you should ensure you are building with the correct params for cloudflare pages.prince binary at build time and potentially execute that during runtime export async function onRequest({ request, next, env }) {
const url = new URL(request.url)
if (url.pathname === "/foo") {
return new Response("foo")
}
if (url.pathname === "/far") {
return new Response("bar")
}
return next()
}