From 69ee6bfb1908dbdf55ae119e1dd0b4cb6fc0004a Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Thu, 30 Apr 2026 16:35:40 -0400 Subject: [PATCH] remove middleware for now --- astro.config.mjs | 4 +--- src/middleware.ts | 26 -------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 src/middleware.ts diff --git a/astro.config.mjs b/astro.config.mjs index 5a2dcd5..154aa62 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -157,7 +157,5 @@ export default defineConfig({ }), docsMarkdownIntegration(), ], - adapter: vercel({ - edgeMiddleware: true, - }), + adapter: vercel(), }); diff --git a/src/middleware.ts b/src/middleware.ts deleted file mode 100644 index 40c7dad..0000000 --- a/src/middleware.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { defineMiddleware } from 'astro:middleware'; -import { - getMarkdownPathFromHtmlPath, - isEligibleDocHtmlPath, - shouldServeMarkdown, -} from './lib/docs-markdown.js'; - -export const onRequest = defineMiddleware((context, next) => { - if (!['GET', 'HEAD'].includes(context.request.method)) { - return next(); - } - - if (!isEligibleDocHtmlPath(context.url.pathname)) { - return next(); - } - - // Content negotiation for AI agents — only needed at runtime. - // Skip during prerendering (both dev and build) to avoid - // Astro.request.headers warnings on every static page. - if (context.isPrerendered || !shouldServeMarkdown(context.request)) { - return next(); - } - - const markdownUrl = new URL(getMarkdownPathFromHtmlPath(context.url.pathname), context.url); - return next(markdownUrl); -});