proxy

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(upstreamURL string, logger *zap.Logger, cfg Config) (http.Handler, error)

Handler returns a reverse proxy to the upstream MCP server. It strips the Authorization header and injects user identity headers. FlushInterval=-1 ensures SSE and chunked streaming work correctly.

Types

type Config added in v1.0.0

type Config struct {
	// UpstreamAuthorization, when non-empty, is set verbatim as the
	// Authorization header on every request forwarded to the upstream
	// MCP backend (and re-applied on every 307/308 redirect hop). The
	// operator provides the full header value including the scheme,
	// e.g. "Bearer s3cr3t" or "Basic dXNlcjpwYXNz". When empty, no
	// Authorization header is sent — the MCP client's own token is
	// already stripped by the Director, so the upstream sees the
	// request un-authenticated at the HTTP layer and must rely on the
	// proxy-injected X-User-* identity headers.
	UpstreamAuthorization string

	// ResponseHeaderTimeoutOverride, when non-zero, replaces the
	// 30s upstreamResponseHeaderTimeout default. Test-only knob —
	// production callers leave this at zero. Documented on the
	// Config struct rather than via a package-level variable so
	// the override is scoped to a single Handler instance and
	// cannot leak into another test running in parallel.
	ResponseHeaderTimeoutOverride time.Duration
}

Config holds optional settings for the reverse-proxy Handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL