96 std::vector<std::pair<std::string, std::string>>
headers;
110 const std::string& strip_prefix,
bool trust_forwarded_headers);
Incremental decoder for a chunked upstream response body.
Definition Proxy.hpp:115
State state_
Definition Proxy.hpp:124
Result
Definition Proxy.hpp:117
size_t remaining_
Definition Proxy.hpp:126
Result feed(std::string_view data, std::string &out)
Decodes as much of data as possible, appending body bytes to out.
std::string line_
Definition Proxy.hpp:125
State
Definition Proxy.hpp:123
routing::Middleware load_balancer(LoadBalancerOptions options)
Returns a middleware that load-balances requests across multiple upstream nodes.
routing::Middleware proxy(ProxyOptions options)
Returns a middleware that proxies requests to a single target URL (ip/hostname and port).
ProxiedRequest snapshot_request(const http::HttpRequest &request)
std::string build_upstream_request(const ProxiedRequest &request, const std::string &host, int port, const std::string &strip_prefix, bool trust_forwarded_headers)
Serializes the request sent upstream. Hop-by-hop headers are dropped case-insensitively,...
Definition HttpRequest.hpp:19
std::function< bool(http::HttpRequest &, std::shared_ptr< http::ResponseWriter >)> Middleware
Definition Router.hpp:19
Represents an incoming HTTP request.
Definition HttpRequest.hpp:54
Options for LoadBalancer middleware.
Definition Proxy.hpp:58
bool verify_tls
Definition Proxy.hpp:61
std::string ca_file
Definition Proxy.hpp:62
std::vector< TargetNode > nodes
Definition Proxy.hpp:59
std::string strip_prefix
Definition Proxy.hpp:60
bool trust_forwarded_headers
Definition Proxy.hpp:63
Options for Proxy middleware.
Definition Proxy.hpp:15
std::string strip_prefix
Definition Proxy.hpp:18
bool trust_forwarded_headers
Keep and extend client-supplied X-Forwarded-* headers.
Definition Proxy.hpp:22
bool use_tls
Connect to the upstream over TLS (also implied by port 443)
Definition Proxy.hpp:19
int target_port
Definition Proxy.hpp:17
std::string ca_file
Optional PEM CA bundle for upstream verification.
Definition Proxy.hpp:21
std::string target_host
Definition Proxy.hpp:16
bool verify_tls
Verify the upstream certificate chain and hostname.
Definition Proxy.hpp:20
A target node for the load balancer.
Definition Proxy.hpp:48
int port
Definition Proxy.hpp:50
std::string host
Definition Proxy.hpp:49
bool use_tls
Connect over TLS (also implied by port 443)
Definition Proxy.hpp:51
An owned copy of the parts of a request the proxy forwards. The original HttpRequest,...
Definition Proxy.hpp:93
std::string body
Definition Proxy.hpp:97
std::string target
Definition Proxy.hpp:95
std::string client_ip
Definition Proxy.hpp:98
std::string method
Definition Proxy.hpp:94
std::vector< std::pair< std::string, std::string > > headers
Definition Proxy.hpp:96