| Crates.io | rebab |
| lib.rs | rebab |
| version | 0.1.2 |
| created_at | 2025-10-12 20:50:31.793052+00 |
| updated_at | 2025-12-21 18:55:49.800332+00 |
| description | A tiny, rule-based reverse proxy written in Rust |
| homepage | |
| repository | https://github.com/lzpel/rebab |
| max_upload_size | |
| id | 1879689 |
| size | 47,957 |
A tiny, rule-based reverse proxy written in Rust. It listens on a single frontend socket address and forwards each incoming request to a backend determined by the first matching rule. Perfect for local dev and simple edge routing without bringing in a full Nginx stack.
config.json)api:8080)You can install rebab directly from crates.io using Cargo:
cargo install rebab
This will place the rebab binary into your Cargo bin directory (usually ~/.cargo/bin).
If you are developing locally instead, you can also build and run it manually:
cargo build --release
cargo run -- --input config.json
rebab --input config.json
config.json{
"frontend": "0.0.0.0:8080",
"comment": "Routing follows the first matching rule.",
"rules":[
{
"frontend_prefix": "/api/",
"backend_port": 8000,
"comment": "Requests whose path starts with 'api' are routed to localhost:8000."
},
{
"frontend_prefix": "/example/",
"backend_host": "example.com",
"comment": "Requests whose path starts with 'example' are routed to example.com (the port inherits the frontend port 8080)."
},
{
"backend_port": 3000,
"comment": "All other requests are routed to localhost:3000."
}
]
}
The complete JSON Schema for config.json is available at src/schema.json.
frontend (string): Socket address to listen on (e.g., 0.0.0.0:8080)
rules[]:
frontend_prefix (string|null): Path prefix to match. If omitted, matches everything.backend_host (string|null): Backend host or IP. Defaults to localhost if omitted.backend_port (integer|null): Backend port. Defaults to the frontend port if omitted.Rules are evaluated in order; the first match wins.
/api/users โ localhost:8000/api/users/example/docs โ example.com:8080/example/docs/anything-else โ localhost:3000/anything-elseConnection, TE, etc.) are removed on proxying.backend_host can be a service name (e.g., "api").