Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
Proxy.hpp
Go to the documentation of this file.
1#pragma once
3#include <vector>
4
5namespace middleware {
6
12 std::string target_host;
14 std::string strip_prefix = "";
15};
16
25
34routing::Middleware proxy(const std::string& target_host, int target_port);
35
40struct TargetNode {
41 std::string host;
42 int port;
43};
44
50 std::vector<TargetNode> nodes;
51 std::string strip_prefix = "";
52};
53
64
72routing::Middleware load_balancer(const std::vector<TargetNode>& nodes);
73
74} // namespace middleware
routing::Middleware proxy(ProxyOptions options)
Returns a middleware that proxies requests to a single target URL (ip/hostname and port).
Definition Proxy.cpp:441
routing::Middleware load_balancer(LoadBalancerOptions options)
Returns a middleware that load-balances requests across multiple upstream nodes.
Definition Proxy.cpp:457
Definition Compress.hpp:4
std::function< bool(http::HttpRequest &, std::shared_ptr< http::ResponseWriter >)> Middleware
Definition Router.hpp:17
Options for LoadBalancer middleware.
Definition Proxy.hpp:49
std::string strip_prefix
Definition Proxy.hpp:51
std::vector< TargetNode > nodes
Definition Proxy.hpp:50
Options for Proxy middleware.
Definition Proxy.hpp:11
int target_port
Definition Proxy.hpp:13
std::string target_host
Definition Proxy.hpp:12
std::string strip_prefix
Definition Proxy.hpp:14
A target node for the load balancer.
Definition Proxy.hpp:40
std::string host
Definition Proxy.hpp:41
int port
Definition Proxy.hpp:42