A HTTP 1.1 reverse proxy written in Rust using hyper (tokio version).
The goal is to build an AWS ELB-like reverse proxy that works well in the dynamic VM/container environments that are starting to be more common. Of particular focus is the ability to manage origins from the pool via some API.
An eventual goal is to have the pool managed by Raft. This will allow a cluster of redundant alacrity servers. This will allow an active/passive setup out of the box. Note: The raft-rs crate does not currently support dynamic membership.
RUST_LOG=alacrity cargo run --bin alacrity
- start the proxycargo run --bin test-server
- start test origin servercurl -vvv localhost:8080
- send a requestcurl -vvv localhost:8080/large
- send a request and get back a large response
RUST_LOG=test_proxy,alacrity cargo test
will execute the tests and provide log level output for both the proxy and the integration tests.
- Initial [0.1.0] release.
- Currently working on a 0.2.0 release.
The management API will allow the addition and removal of origins from the pool. It will also allow for the dynamic configuration of other options, such as the health check.
- Servers must register with the load balancer using an HTTP POST to the management IP.
- The POST payload contains the health check information.
- The load balancer will keep that server active in the pool as long as the health succeeds.
POST /servers
{
"ip": "120.0.0.1",
"port": "8080",
}
Example: curl -vvv localhost:8687/servers -d '{"ip":"127.0.0.1", "port":"12345"}'
Note: It is more common for a server to fall out of the pool after n
health checks fail.
DELETE /servers/:ip/:port
Example: curl -vvv -X DELETE localhost:8687/servers/127.0.0.1/12345
Work in progress.
GET /stats
{
"client": {
"success": 34534,
"failed": 33,
},
"server": {
"success": 33770,
"failed": 15,
}
}
Work in progress.
GET /stats/detail
[{
"id": "...",
"ip": "127.0.0.1",
"port": "8080",
"success": 33770,
"failed": 15,
},{
...
}]
- @hoverbear - for talking through some of the design with me early on
- @Geal - for talking through some of the design with me early on and sharing code samples
- @yanns - for setting up the integration tests and implementation help
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.