microserve.proxy module

Files

file proxy.cppm

Classes

struct microserve::ProxyTarget
Parsed proxy_pass value (nginx-compatible).

Functions

auto parse_proxy_pass(std::string_view proxy_pass) -> ProxyTarget
Parse a proxy_pass directive into scheme, host, port, and URI.
auto rewrite_proxy_target(std::string_view location, std::string_view request_target, const ProxyTarget& target) -> std::string
Rewrite the request target for the upstream.
auto resolve_proxy_upstream(const ProxyTarget& target, const std::vector<BackendConfig>& backends, std::string& host, unsigned short& port) -> bool
Resolve the upstream host and port for a parsed target.
void proxy_request(const Request& req, Response& res, std::string_view location_path, std::string_view proxy_pass, const std::vector<BackendConfig>& backends, const Config::TimeoutConfig& timeouts)
Reverse-proxy an HTTP request to an upstream.