← all modules
module

stdlib::http::proxy

defined in C:\Users\bye45\.glide\bin/src/stdlib/http/proxy.glide

Reverse-proxy configuration. The minimal setup is an upstream

struct struct ReverseProxyConfig

Reverse-proxy configuration. The minimal setup is an upstream origin such as http://127.0.0.1:9000; the proxy forwards the incoming method, path, body and safe end-to-end headers.

strip_prefix is useful for mounting an app under a local prefix: with strip_prefix = "/api", /api/users?x=1 is sent upstream as /users?x=1.

fn fn reverse_proxy(cfg: *ReverseProxyConfig, req: *HttpRequest) -> HttpResponse

Forward req to cfg.upstream and lower the upstream response back into the server-side HttpResponse shape. Network and parse errors become 502 Bad Gateway.

fn fn proxy_build_upstream_request(cfg: *ReverseProxyConfig, req: *HttpRequest) -> *HttpClientRequest

Build the client request that reverse_proxy will send upstream. Exposed for tests and for custom proxy pipelines that want to inspect or adjust the request before calling HttpClient::do.

fn fn proxy_target_url(cfg: *ReverseProxyConfig, path: string) -> string

Compute the upstream URL for a request path.

fn fn proxy_filter_request_headers(block: string, preserve_host: bool) -> string

Drop hop-by-hop headers from the request before proxying. Host is also dropped unless preserve_host is true, because the client transport will stamp the upstream host by default.

fn fn proxy_filter_response_headers(block: string) -> string

Drop hop-by-hop and framing headers from an upstream response. The local server re-emits Content-Length and Connection itself.

fn fn proxy_rewrite_location(loc: string, upstream: string, public_base: string) -> string

Rewrite an absolute upstream Location value to the public proxy base. Relative locations are left untouched.