Expand description
The server layer of rust-web-server:
the HTTP/1.1, HTTP/2 and HTTP/3 servers, TLS, the App and its
controllers, routing, state-aware apps, middleware, MCP, OpenAPI, SSO,
sessions, metrics, OpenTelemetry, the HTTP client and the model layer.
Internal to rust-web-server, released with it at the same version: use
these through the rust_web_server paths, which stay stable; this
crate’s own layout may change in any release. See
spec/WORKSPACE_SPLIT.md.
Modules§
- app
- application
- Application: the type a server runs for every request.
- async_
state http2 - Async-capable state-aware application — requires the
http2feature (tokio). - auth
auth - Built-in authentication middleware (
authCargo feature). - authz
- Authorization (18.14.0, #32): who the caller is (
Identity), and — from later tranches — what they may do, as relationship-based access control (Zanzibar-style tuples and a schema). - blocklist
- Runtime IP blocklist middleware.
- cache
- In-memory response cache middleware.
- circuit_
breaker Non-WebAssembly - Circuit breaker state machine and retry middleware.
- config_
binding - Typed configuration binding — read environment variables into strongly-typed structs.
- config_
reload - Hot configuration reload.
- config_
watch Non-WebAssembly - Reload when the config file or a certificate changes (
watch = true, #10). - controller
- Controllers: one unit of request handling for
App. - cookie
- crypto
crypto - Password hashing and secure token generation.
- csrf
csrf - CSRF protection middleware using the double-submit cookie pattern.
- di
- Lightweight type-keyed dependency injection container.
- disk_
guard - Keep rws from filling a disk (18.15.0): before writing to a file it
keeps growing — the access log, the disk cache — rws asks
has_room. BelowRWS_CONFIG_MIN_FREE_DISKfree on that file’s filesystem the write is skipped (and counted) until space comes back: a full disk costs log lines and cache entries, never the server or whatever shares the disk with it. - early_
hints 103 Early Hints(RFC 8297, 18.12.0, #38):Linkheaders a client can act on — preload a stylesheet, preconnect to an origin — while the response is still being made.- feature
- Runtime feature toggles.
- handler
- Typed handlers (18.28.0, #86): extractors as function arguments, any
IntoResponseas the return value, the route’s method and pattern taken from the#[get]/#[post]/… attribute. - http_
client - Outbound HTTP/1.1 client.
- ip_
filter - IP address allowlist and denylist middleware.
- language
- log
Non-WebAssembly - maintenance
- Maintenance mode middleware.
- mcp
- Model Context Protocol (MCP) server — HTTP Streamable HTTP transport.
- metrics
- Server-wide and per-route Prometheus metrics.
- middleware
- Composable middleware pipeline.
- model
model-mysqlormodel-postgresormodel-sqlite - Model — Async Database Access Layer
- openapi
openapi - OpenAPI 3.1 documents generated from registered routes, with request and response schemas from serde types.
- otel
Non-WebAssembly - OpenTelemetry-compatible distributed tracing.
- pagination
- Pagination result types (
Page<T>,CursorPage<T>) and an RFC 8288Linkheader builder. - rate_
limit - request_
id - Request ID / correlation ID middleware.
- request_
log - In-memory ring buffer of recent HTTP requests.
- rewrite
- Request and response rewriting middleware.
- router
- rsa_key
auth-asymmetricorsso - RSA public keys and RS256 / rsa-sha256 signature verification (no
rsacrate). RSA public keys and RSASSA-PKCS1-v1_5 / SHA-256 signature verification — everythingrwsdoes with RSA (RS256 JWTs, SAMLrsa-sha256signatures), implemented in-crate. - scheduler
- Background task scheduler — a
@Scheduled-style runner for fixed-rate, fixed-delay, and cron-expression tasks. - schema
- JSON Schema for Rust types, for MCP tool
inputSchema/outputSchema. - secrets
secrets - Secret-reference resolution for HashiCorp Vault, AWS Secrets Manager, and
Azure Key Vault — no vendor SDK for any of the three, matching this
crate’s existing
storage-s3/storage-azure/ssomodules. - server
- The listeners and connection loops.
- service_
discovery - Dynamic backend pool with pluggable discovery sources.
- session
- Server-side session management.
- sse
- Server-Sent Events (SSE).
- sso
sso - OAuth 2.0 / OIDC SSO client support.
- state
- Shared application state and state-aware routing.
- storage
secretsorstorage-azureorstorage-gcsorstorage-localorstorage-s3 - The part of
storagethe server layer needs:StorageErrorand the AWS (SigV4, credential chain) and Azure (Managed Identity) credential helperssecretsshares with the S3 and Azure Blob backends, which are rust-web-server’sstorage. - systemd
Unix and ( http1orhttp2) - systemd integration (18.20.0, #67), without libsystemd.
- test_
client - thread_
pool Non-WebAssembly - timeout
Non-WebAssembly - Per-route request timeouts.
- validate
- websocket
Non-WebAssembly - WebSocket protocol support — RFC 6455.
Constants§
- FIPS
- Whether this build uses the FIPS module (
fipsfeature).
Functions§
- crypto_
provider ( http-clientorhttp2) and non-WebAssembly - The rustls crypto provider every TLS config uses: aws-lc-rs, or with the
fipsfeature its FIPS 140-3 validated module and only the algorithms FIPS approves (18.23.0).