Skip to content

Open-source status page, incident response and uptime monitoring

web: fix markdown rewrite (#2864)

Thibault Le Ouay660577eadb4a
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index 73b55eb84..768b77fae 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -391,10 +391,12 @@ const nextConfig: NextConfig = {
source: "/:path*\\.md",
destination: "/api/markdown/:path*",
},
- // Markdown content negotiation for AI tools
+ // Markdown content negotiation for AI tools. beforeFiles rewrites
+ // chain, so skip paths the .md rule above already rewrote — otherwise
+ // /pricing.md + Accept: text/markdown ends up at /api/markdown/api/markdown/pricing
{
- source: "/:path*",
- destination: "/api/markdown/:path*",
+ source: "/:path((?!api/markdown(?:/|$)).+)",
+ destination: "/api/markdown/:path",
has: [
{
type: "header",