Expand description
A Pingora reverse proxy for Autumn.
ⓘ
use autumn_plugin_pingora::{PingoraPlugin, Route};
#[autumn_web::main]
async fn main() {
autumn_web::app()
.routes(routes![index])
.plugin(PingoraPlugin::new().route(
Route::new("billing").path_prefix("/billing").upstream("10.0.0.7:8080"),
))
.run()
.await;
}The proxy has its own listener. The default is 127.0.0.1:8080 in
dev and test, and 0.0.0.0:8080 in other profiles. The proxy sends
matched requests to the route’s upstream pool. It sends all other
requests to the Autumn app. It adds:
- round-robin or consistent-hash load balancing,
- TCP health checks and connect retries,
X-Forwarded-*headers,- body and connection limits,
- a
pingoraindicator in/actuator/health, pingora_proxy_*metrics in/actuator/prometheus,- graceful drain on Autumn’s shutdown signal.
See PingoraConfig for the [pingora] section of autumn.toml.
Structs§
- Config
Error - A configuration problem. Boot stops.
- Lifecycle
Cell - A shared, atomic
Lifecycle. The only way to change the state. - Pingora
Config - Settings for the proxy.
- Pingora
Handle - A handle to the proxy. Clone it freely. It is valid before and after boot.
- Pingora
Plugin - Runs a Pingora reverse proxy inside an Autumn app.
- Resolved
- A resolved configuration and the active profile.
- Route
- One route: a match rule and an upstream pool.
- Upstream
Health - Upstream health for one route.
Enums§
- Fallback
- Where unmatched requests go.
- Lifecycle
- The state of the proxy.
- Lifecycle
Event - An input to the state machine.
- Pingora
Error - A startup failure. Boot stops. The plugin never falls back silently. Autumn shows the message in its boot error.
- Selection
- How a route picks an upstream.
Constants§
- DEFAULT_
PORT - The default proxy port.
- DEFAULT_
SECTION - The default config section.
- MAX_
CONNECTIONS_ LIMIT - Largest
max_connections. - PLUGIN_
NAME - The name in
Plugin::name, logs and errors.