From b6f96361713acd1920dadffec9a0e033caa15b94 Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Sat, 21 Mar 2026 18:18:26 -0700 Subject: [PATCH] =?UTF-8?q?fix(admin-web):=20proxy=20routes=20forward=20bo?= =?UTF-8?q?dy=20on=20DELETE=20=E2=80=94=20use=20method=20!=3D=3D=20GET/HEA?= =?UTF-8?q?D=20guard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboards/admin-web/src/app/api/agent-evals/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/ai-budgets/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/delivery/[...path]/route.ts | 2 +- .../src/app/api/event-subscriptions/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/ip-rules/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/jobs/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/knowledge/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/maintenance/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/marketplace/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/orgs/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/reviews/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/sessions/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/support/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/waitlist/[...path]/route.ts | 2 +- dashboards/admin-web/src/app/api/webhooks/[...path]/route.ts | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dashboards/admin-web/src/app/api/agent-evals/[...path]/route.ts b/dashboards/admin-web/src/app/api/agent-evals/[...path]/route.ts index 4b884245..2eb3260c 100644 --- a/dashboards/admin-web/src/app/api/agent-evals/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/agent-evals/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/ai-budgets/[...path]/route.ts b/dashboards/admin-web/src/app/api/ai-budgets/[...path]/route.ts index 7a87c74d..13608b8f 100644 --- a/dashboards/admin-web/src/app/api/ai-budgets/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/ai-budgets/[...path]/route.ts @@ -29,7 +29,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) { + if (req.method !== 'GET' && req.method !== 'HEAD') { fetchOptions.body = await req.text(); } diff --git a/dashboards/admin-web/src/app/api/delivery/[...path]/route.ts b/dashboards/admin-web/src/app/api/delivery/[...path]/route.ts index f8ef65c2..acaac1be 100644 --- a/dashboards/admin-web/src/app/api/delivery/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/delivery/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/event-subscriptions/[...path]/route.ts b/dashboards/admin-web/src/app/api/event-subscriptions/[...path]/route.ts index 2dd70638..41369a25 100644 --- a/dashboards/admin-web/src/app/api/event-subscriptions/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/event-subscriptions/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/ip-rules/[...path]/route.ts b/dashboards/admin-web/src/app/api/ip-rules/[...path]/route.ts index 35f4a1ba..c8c1eed0 100644 --- a/dashboards/admin-web/src/app/api/ip-rules/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/ip-rules/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/jobs/[...path]/route.ts b/dashboards/admin-web/src/app/api/jobs/[...path]/route.ts index 75d75e40..2ad4616c 100644 --- a/dashboards/admin-web/src/app/api/jobs/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/jobs/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/knowledge/[...path]/route.ts b/dashboards/admin-web/src/app/api/knowledge/[...path]/route.ts index 9433fae0..cddc5a6b 100644 --- a/dashboards/admin-web/src/app/api/knowledge/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/knowledge/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/maintenance/[...path]/route.ts b/dashboards/admin-web/src/app/api/maintenance/[...path]/route.ts index 2bbb0354..a2960bf0 100644 --- a/dashboards/admin-web/src/app/api/maintenance/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/maintenance/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/marketplace/[...path]/route.ts b/dashboards/admin-web/src/app/api/marketplace/[...path]/route.ts index 7fbf9a08..290e263c 100644 --- a/dashboards/admin-web/src/app/api/marketplace/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/marketplace/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/orgs/[...path]/route.ts b/dashboards/admin-web/src/app/api/orgs/[...path]/route.ts index 284dac50..8834ab8b 100644 --- a/dashboards/admin-web/src/app/api/orgs/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/orgs/[...path]/route.ts @@ -29,7 +29,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) { + if (req.method !== 'GET' && req.method !== 'HEAD') { fetchOptions.body = await req.text(); } diff --git a/dashboards/admin-web/src/app/api/reviews/[...path]/route.ts b/dashboards/admin-web/src/app/api/reviews/[...path]/route.ts index 293b7f60..232c29c4 100644 --- a/dashboards/admin-web/src/app/api/reviews/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/reviews/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/sessions/[...path]/route.ts b/dashboards/admin-web/src/app/api/sessions/[...path]/route.ts index 54c45d14..8898ff51 100644 --- a/dashboards/admin-web/src/app/api/sessions/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/sessions/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status }); diff --git a/dashboards/admin-web/src/app/api/support/[...path]/route.ts b/dashboards/admin-web/src/app/api/support/[...path]/route.ts index 008f1efc..2f3643ee 100644 --- a/dashboards/admin-web/src/app/api/support/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/support/[...path]/route.ts @@ -29,7 +29,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) { + if (req.method !== 'GET' && req.method !== 'HEAD') { fetchOptions.body = await req.text(); } diff --git a/dashboards/admin-web/src/app/api/waitlist/[...path]/route.ts b/dashboards/admin-web/src/app/api/waitlist/[...path]/route.ts index 2231aa81..d611c37b 100644 --- a/dashboards/admin-web/src/app/api/waitlist/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/waitlist/[...path]/route.ts @@ -29,7 +29,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) { + if (req.method !== 'GET' && req.method !== 'HEAD') { fetchOptions.body = await req.text(); } diff --git a/dashboards/admin-web/src/app/api/webhooks/[...path]/route.ts b/dashboards/admin-web/src/app/api/webhooks/[...path]/route.ts index bda11409..dd387fbe 100644 --- a/dashboards/admin-web/src/app/api/webhooks/[...path]/route.ts +++ b/dashboards/admin-web/src/app/api/webhooks/[...path]/route.ts @@ -22,7 +22,7 @@ async function proxy(req: NextRequest, { params }: { params: Promise<{ path: str 'x-product-id': req.headers.get('x-product-id') || process.env.PRODUCT_ID || 'lysnrai', }; const fetchOptions: RequestInit = { method: req.method, headers }; - if (['POST', 'PUT', 'PATCH'].includes(req.method)) fetchOptions.body = await req.text(); + if (req.method !== 'GET' && req.method !== 'HEAD') fetchOptions.body = await req.text(); const res = await fetch(`${PLATFORM_URL}${targetPath}${qs}`, fetchOptions); const data = await res.json().catch(() => null); return NextResponse.json(data ?? { error: res.statusText }, { status: res.status });