RXH
RXH is an HTTP reverse proxy built with hyper
and tokio just for fun. The
configuration file (rxh.toml) accepts this options:
# Simple proxy example. All requests sent to port 8000 are forwarded to port
# 8080, including HTTP/1.1 upgrade requests. Upgraded requests will have their
# dedicated TCP tunnel.
[[]]
= "127.0.0.1:8000"
= "127.0.0.1:8080"
# Simple static files server example. This server will run in parallel with the
# one defined above, as the configuration file accepts multiple server
# instances on different ports.
[[]]
= "127.0.0.1:9000"
= "/home/user/website"
# Complex server example. In this case, the server listens on multiple IP
# addresses, should load balance requests that start with "/api" between ports
# 8080 and 8081 and also serves files from a directory.
[[]]
= ["127.0.0.1:8100", "192.168.1.2:8100"]
= [
{ = "/api", = ["127.0.0.1:8080", "127.0.0.1:8081"] },
{ = "/", = "/home/user/website" },
]
# Weighted load balancing example using WRR (Weighted Round Robin) algorithm.
# With this configuration, from every 6 requests received by the proxy at port
# 8200, 1 will be forwarded to port 8080, 3 of them will be forwarded to port
# 8081 and 2 of them to port 8082.
[[]]
= ["127.0.0.1:8200", "192.168.1.2:8200"]
[[]]
= "WRR" # This is the default, and this is also the only one for now.
= [
{ = "127.0.0.1:8080", = 1 },
{ = "127.0.0.1:8081", = 3 },
{ = "127.0.0.1:8082", = 2 },
]
Start the server using cargo:
Features
- HTTP
Forwardedheader (RFC 7239). - Graceful shutdown (don't kill the process until all sockets are closed).
- HTTP/1.1 upgraded connections (works like a TCP tunnel).
- HTTP
Viaheader (Section 3.6.7 of RFC 5322) - HTTP/2
- Static files server.
- Multiple servers on different ports, both static and proxy.
- Header customization configs (see
config.sketch.toml). - Hot reloading (switch the config on the fly without stopping).
- Cache.
- Load balancing.
- Dameonize process.
- TLS.