API reference¶
Use serve() with a Config for the standard server entrypoint, or Server to embed one worker in an existing event loop. The reference is grouped by the ASGI concept a symbol describes; each page contains the complete signature and docstring.
Blazing-fast HTTP/2 ASGI server for Python, written in Rust.
h2corn is optimized for h2c behind a trusted reverse proxy, with optional direct TLS support for TCP deployments. Application traffic stays on HTTP/2 end-to-end instead of being downgraded to HTTP/1.1 inside the trust boundary.
The two entrypoints are:
serve— start the server through the multi-worker supervisor (Unix) or in-process (Windows). This matches the behavior of theh2cornCLI.Server— embed a single-worker server in your own event loop.
Configuration is provided through Config, which is also constructable from environment variables or a TOML file.
For per-option descriptions, defaults, environment variables, and CLI flags, see the Configuration reference.