diff --git a/.changeset/popular-turtles-sort.md b/.changeset/popular-turtles-sort.md new file mode 100644 index 000000000000..326b786419cb --- /dev/null +++ b/.changeset/popular-turtles-sort.md @@ -0,0 +1,5 @@ +--- +"@astrojs/vercel": patch +--- + +Fixes edge middleware calling nested routes diff --git a/packages/integrations/vercel/src/serverless/middleware.ts b/packages/integrations/vercel/src/serverless/middleware.ts index 91d03287371a..bf38a3a9f4c0 100644 --- a/packages/integrations/vercel/src/serverless/middleware.ts +++ b/packages/integrations/vercel/src/serverless/middleware.ts @@ -90,7 +90,7 @@ export default async function middleware(request, context) { ctx.locals = ${handlerTemplateCall}; const { origin } = new URL(request.url); const next = () => - fetch(new URL('${NODE_PATH}', request.url), { + fetch(new URL('/${NODE_PATH}', request.url), { headers: { ...Object.fromEntries(request.headers.entries()), '${ASTRO_MIDDLEWARE_SECRET_HEADER}': '${middlewareSecret}',