| Crates.io | rxh |
| lib.rs | rxh |
| version | 0.1.0 |
| created_at | 2023-01-28 19:54:32.765673+00 |
| updated_at | 2023-01-28 19:54:32.765673+00 |
| description | HTTP reverse proxy & load balancer |
| homepage | |
| repository | https://github.com/antoniosarosi/rxh |
| max_upload_size | |
| id | 770556 |
| size | 115,599 |
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.
[[server]]
listen = "127.0.0.1:8000"
forward = "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.
[[server]]
listen = "127.0.0.1:9000"
serve = "/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.
[[server]]
listen = ["127.0.0.1:8100", "192.168.1.2:8100"]
match = [
{ uri = "/api", forward = ["127.0.0.1:8080", "127.0.0.1:8081"] },
{ uri = "/", serve = "/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.
[[server]]
listen = ["127.0.0.1:8200", "192.168.1.2:8200"]
[[server.forward]]
algorithm = "WRR" # This is the default, and this is also the only one for now.
backends = [
{ address = "127.0.0.1:8080", weight = 1 },
{ address = "127.0.0.1:8081", weight = 3 },
{ address = "127.0.0.1:8082", weight = 2 },
]
Start the server using cargo:
cargo run
Forwarded header (RFC 7239).Via header (Section 3.6.7 of RFC 5322)config.sketch.toml).