Expand description
Upstream request forwarding.
Once the pipeline allows (or redacts) a request, forward_request sends
the body upstream. Responses are streamed back by the handler.
Constants§
- HOP_
BY_ HOP_ HEADERS - Hop-by-hop headers (RFC 9110, section 7.6.1). They describe one connection,
not the message, so a proxy must not pass them on in either direction.
Any header named in a
Connectionheader is hop-by-hop too; seeforwardable_headers. - STRIPPED_
REQUEST_ HEADERS - Headers stripped from the request before forwarding upstream, in
addition to
HOP_BY_HOP_HEADERS. - STRIPPED_
RESPONSE_ HEADERS - Headers stripped from the upstream response before it goes back to
the client, in addition to
HOP_BY_HOP_HEADERS.content-lengthis recomputed by the proxy’s HTTP server, since redaction can change the body.
Functions§
- forward_
passthrough - Forward a request on a passthrough route (
server.passthrough_paths) with its method, body and headers as the client sent them. - forward_
request - Forward a (possibly redacted) request body to the upstream LLM API.
- forwardable_
headers - The headers of
headersthat may be forwarded, as lowercase name/value pairs: everything exceptHOP_BY_HOP_HEADERS, headers named in aConnectionheader,extra_stripped, and values that aren’t visible ASCII. - read_
body - Read the full response body as bytes.