Skip to main content

Crate rws_server

Crate rws_server 

Source
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_statehttp2
Async-capable state-aware application — requires the http2 feature (tokio).
authauth
Built-in authentication middleware (auth Cargo 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_breakerNon-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_watchNon-WebAssembly
Reload when the config file or a certificate changes (watch = true, #10).
controller
Controllers: one unit of request handling for App.
cookie
cryptocrypto
Password hashing and secure token generation.
csrfcsrf
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. Below RWS_CONFIG_MIN_FREE_DISK free 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): Link headers 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 IntoResponse as 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
logNon-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.
modelmodel-mysql or model-postgres or model-sqlite
Model — Async Database Access Layer
openapiopenapi
OpenAPI 3.1 documents generated from registered routes, with request and response schemas from serde types.
otelNon-WebAssembly
OpenTelemetry-compatible distributed tracing.
pagination
Pagination result types (Page<T>, CursorPage<T>) and an RFC 8288 Link header 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_keyauth-asymmetric or sso
RSA public keys and RS256 / rsa-sha256 signature verification (no rsa crate). RSA public keys and RSASSA-PKCS1-v1_5 / SHA-256 signature verification — everything rws does with RSA (RS256 JWTs, SAML rsa-sha256 signatures), 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.
secretssecrets
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/sso modules.
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).
ssosso
OAuth 2.0 / OIDC SSO client support.
state
Shared application state and state-aware routing.
storagesecrets or storage-azure or storage-gcs or storage-local or storage-s3
The part of storage the server layer needs: StorageError and the AWS (SigV4, credential chain) and Azure (Managed Identity) credential helpers secrets shares with the S3 and Azure Blob backends, which are rust-web-server’s storage.
systemdUnix and (http1 or http2)
systemd integration (18.20.0, #67), without libsystemd.
test_client
thread_poolNon-WebAssembly
timeoutNon-WebAssembly
Per-route request timeouts.
validate
websocketNon-WebAssembly
WebSocket protocol support — RFC 6455.

Constants§

FIPS
Whether this build uses the FIPS module (fips feature).

Functions§

crypto_provider(http-client or http2) and non-WebAssembly
The rustls crypto provider every TLS config uses: aws-lc-rs, or with the fips feature its FIPS 140-3 validated module and only the algorithms FIPS approves (18.23.0).