@devries-cameron20 / composio Mirror · read-only / commits / 8e493ae50
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 12:00 UTC

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

Add middleware to forward x-pathname header so the not-found page can log the actual requested URL path instead of 'unknown'. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

sohamganatra committed Jan 28, 2026 at 16:46 UTC 8e493ae505042a078e46601fe562b56a3554eafc
2 files changed +15 -1
docs/app/not-found.tsx
+1 -1
@@ -33,7 +33,7 @@ async function log404ToDatadog(path: string, referer: string | null) {
33 export default async function NotFound() {
34 const headersList = await headers();
35 const referer = headersList.get('referer');
36 - const path = headersList.get('x-nextjs-page') || headersList.get('x-invoke-path') || 'unknown';
36 + const path = headersList.get('x-pathname') || headersList.get('x-invoke-path') || 'unknown';
37
38 // Fire and forget - don't block rendering
39 log404ToDatadog(path, referer);
docs/middleware.ts new
+14
@@ -0,0 +1,14 @@
1 +import { NextResponse } from 'next/server';
2 +import type { NextRequest } from 'next/server';
3 +
4 +export function middleware(request: NextRequest) {
5 + const response = NextResponse.next();
6 + response.headers.set('x-pathname', request.nextUrl.pathname);
7 + return response;
8 +}
9 +
10 +export const config = {
11 + matcher: [
12 + '/((?!_next/static|_next/image|favicon.ico|icon.png|apple-icon.png).*)',
13 + ],
14 +};