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); -});