Skip to main content

Module reverse

Module reverse 

Source
Expand description

Reverse proxy handler (Mode 2 — Credential Injection).

Routes requests by path prefix to upstream APIs, injecting credentials from the keystore. The agent uses http://localhost:PORT/openai/v1/chat and the proxy rewrites to https://api.openai.com/v1/chat with the real credential injected.

Supports multiple injection modes:

  • header: Inject into HTTP header (e.g., Authorization: Bearer ...)
  • url_path: Replace pattern in URL path (e.g., Telegram /bot{}/)
  • query_param: Add/replace query parameter (e.g., ?api_key=...)
  • basic_auth: HTTP Basic Authentication

Streaming responses (SSE, MCP Streamable HTTP, A2A JSON-RPC) are forwarded without buffering.

Structs§

ReverseProxyCtx
Handle a non-CONNECT HTTP request (reverse proxy mode).

Functions§

handle_reverse_proxy
Handle a non-CONNECT HTTP request (reverse proxy mode).