Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(docs): Capture actual path in 404 Datadog logs

sohamganatra8e493ae50504
diff --git a/docs/app/not-found.tsx b/docs/app/not-found.tsx
index 997ab7638..e583abfcc 100644
--- a/docs/app/not-found.tsx
+++ b/docs/app/not-found.tsx
@@ -33,7 +33,7 @@ async function log404ToDatadog(path: string, referer: string | null) {
export default async function NotFound() {
const headersList = await headers();
const referer = headersList.get('referer');
- const path = headersList.get('x-nextjs-page') || headersList.get('x-invoke-path') || 'unknown';
+ const path = headersList.get('x-pathname') || headersList.get('x-invoke-path') || 'unknown';
// Fire and forget - don't block rendering
log404ToDatadog(path, referer);
diff --git a/docs/middleware.ts b/docs/middleware.ts
new file mode 100644
index 000000000..a43a5df81
--- /dev/null
+++ b/docs/middleware.ts
@@ -0,0 +1,14 @@
+import { NextResponse } from 'next/server';
+import type { NextRequest } from 'next/server';
+
+export function middleware(request: NextRequest) {
+ const response = NextResponse.next();
+ response.headers.set('x-pathname', request.nextUrl.pathname);
+ return response;
+}
+
+export const config = {
+ matcher: [
+ '/((?!_next/static|_next/image|favicon.ico|icon.png|apple-icon.png).*)',
+ ],
+};