feat(frontend): add catch-all proxy route for ambient API v1#1511
Draft
feat(frontend): add catch-all proxy route for ambient API v1#1511
Conversation
Add /api/ambient/v1/[...path] catch-all route that proxies requests to the ambient-api-server backend. Supports all HTTP methods, SSE streaming, and request body forwarding with auth header injection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ng for API proxy - Add API_SERVER_URL to base frontend deployment manifest - Add API_SERVER_URL to e2e overlay frontend patch - Log upstream errors for debugging - Exclude AbortError and ResponseAborted from streaming error logs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ev config - Forward client Accept header for SSE endpoint compatibility - Reject path traversal segments (.. and .) - Add API_SERVER_URL to local-dev deployment overlays - Remove internal hostname leak from 502 error responses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cases Use Request/Response.json instead of NextRequest/NextResponse, read body eagerly with request.text() matching all other routes, conditionally set body only for POST/PUT/PATCH, close SSE writable when upstream body is null to prevent client hang, and include details field in error responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/ambient/v1/[...path]catch-all Next.js API route that proxies all HTTP methods (GET, POST, PUT, PATCH, DELETE) to theambient-api-serverbackendAPI_SERVER_URLenv var configuration toconfig.ts,env.ts, and.env.example(default:http://localhost:8000)text/event-stream,application/x-ndjson) viaTransformStreampipe-through pattern matching existing AG-UI events proxybuildForwardHeadersAsyncfor consistent authenticationTest plan
tsc --noEmitpasses with 0 errorsnpm run buildpasses with 0 errors, 0 warningsCo-Authored-By: Claude Opus 4.6 noreply@anthropic.com