# uvicorn.run() > Guide to `uvicorn.run()`, the programmatic interface of the Uvicorn ASGI server: every parameter with its type and default, examples, HTTPS, deployment and upgrade notes. Up to date with uvicorn 0.54.0 (September 2026). Source: https://uvicorn.run/ (last updated 2026-10-07) ## uvicorn.run() Page: https://uvicorn.run/ ### What is uvicorn.run()? `uvicorn.run()` is the programmatic interface to Uvicorn, Python's lightning-fast ASGI web server. Unlike the command-line interface, it allows you to start and configure your server directly from Python code, giving you complete control over server lifecycle and configuration. Perfect for production deployments, testing environments, and applications that need dynamic server configuration, `uvicorn.run()` is the go-to choice for modern Python web applications built with FastAPI, Starlette, and other ASGI frameworks. **Requirements:** Python 3.10+ (as of uvicorn 0.40.0). Python 3.14 is supported since uvicorn 0.38.0. For optimal performance, install with `pip install uvicorn[standard]` which includes `uvloop` and `httptools`. The latest version is **0.54.0** (September 2026). See [what changed recently](https://uvicorn.run/upgrading/#whats-new). ### Quick Start Get up and running with `uvicorn.run()` in seconds: ```python import uvicorn from fastapi import FastAPI app = FastAPI() @app.get("/") async def read_root(): return {"message": "Hello, World!"} if __name__ == "__main__": uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) ``` That's it! Your ASGI application is now running with automatic reloading enabled for development. ## Parameters Reference Page: https://uvicorn.run/parameters/ Every argument of `uvicorn.run()` is keyword-only, except `app`. `uvicorn.Config` accepts the same arguments, except `app_dir`. Most of them have a command-line flag with dashes instead of underscores (`ssl_keyfile` becomes `--ssl-keyfile`). Each parameter comes with an example (expand it for the surrounding code) and has an anchor, for example [/parameters/#ssl_context_factory](https://uvicorn.run/parameters/#ssl_context_factory). ### Application - `app` (`str | ASGI App`): Your ASGI application. Can be a string in "module:attribute" format or the application object directly. Use the string with `reload` or `workers`. Example: `uvicorn.run(app, host="0.0.0.0", port=8000)` - `factory` (`bool`, default `False`): Treat app as an application factory (a callable that returns an ASGI app). Example: `uvicorn.run("main:create_app", factory=True)` - `app_dir` (`str`, default `current directory`): Directory to add to sys.path when looking for the application module. Example: `uvicorn.run("myproject.main:app", app_dir="src")` - `reset_contextvars` (`bool`, default `False`): Run each ASGI request in a fresh contextvars.Context. Works around a context leak in asyncio (uvloop is not affected). Hides context set during lifespan from request handlers. Example: `uvicorn.run("main:app", reset_contextvars=True)` ### Socket Binding - `host` (`str`, default `"127.0.0.1"`): Bind socket to this host. Use "0.0.0.0" to make the server available externally. Example: `uvicorn.run("main:app", host="0.0.0.0") # reachable from other machines` - `port` (`int`, default `8000`): Bind socket to this port. Use 0 to bind to an available port. Example: `uvicorn.run("main:app", port=int(os.environ.get("PORT", "8000")))` - `uds` (`str`): Bind to a UNIX domain socket instead of TCP. Useful for reverse proxy setups. Example: `uvicorn.run("main:app", uds="/run/myapp/uvicorn.sock")` - `fd` (`int`): Bind to socket from this file descriptor. Useful for socket activation. Example: `uvicorn.run("main:app", fd=3) # first socket passed by systemd` ### Development - `reload` (`bool`, default `False`): Enable auto-reload for development. Watches for file changes and restarts the server. The app must be an import string. Example: `uvicorn.run("main:app", reload=True)` - `reload_dirs` (`list[str]`, default `current directory`): Directories to watch for file changes when reload is enabled. Example: `uvicorn.run("main:app", reload=True, reload_dirs=["src", "templates"])` - `reload_delay` (`float`, default `0.25`): Delay in seconds between detecting a change and reloading. Example: `uvicorn.run("main:app", reload=True, reload_delay=1.0)` - `reload_includes` (`list[str]`): Glob patterns for files to include in reload watching. Requires watchfiles. Example: `uvicorn.run("main:app", reload=True, reload_includes=["*.py", "*.html"])` - `reload_excludes` (`list[str]`): Glob patterns for files to exclude from reload watching. Requires watchfiles. Example: `uvicorn.run("main:app", reload=True, reload_excludes=["tests/*", "*.tmp"])` ### Production - `workers` (`int`, default `1`): Number of worker processes. Reads from $WEB_CONCURRENCY env var if set. Cannot be used with reload. Send SIGHUP to restart workers one at a time without dropping requests. Example: `uvicorn.run("main:app", host="0.0.0.0", workers=os.cpu_count())` - `env_file` (`str`): Path to environment configuration file to load. Requires python-dotenv. Example: `uvicorn.run("main:app", env_file=".env")` - `timeout_worker_healthcheck` (`int`, default `5`): Timeout in seconds for worker health check. Example: `uvicorn.run("main:app", workers=4, timeout_worker_healthcheck=10)` ### Logging - `log_level` (`str`, default `"info"`): Logging level: "critical", "error", "warning", "info", "debug", "trace" (case-insensitive). Example: `uvicorn.run("main:app", log_level="debug")` - `log_config` (`str | PathLike | dict`, default `LOGGING_CONFIG`): Logging configuration file path (.json, .yaml or .ini) or a dictionary config. YAML requires PyYAML. None leaves logging untouched. Example: `uvicorn.run("main:app", log_config=LOGGING) # or a .json, .yaml or .ini path` - `access_log` (`bool`, default `True`): Enable or disable access logging. Example: `uvicorn.run("main:app", access_log=False) # the reverse proxy logs requests` - `use_colors` (`bool`, default `auto-detected`): Enable or disable colorized log formatting. Example: `uvicorn.run("main:app", use_colors=False) # plain logs for log collectors` ### Protocol Implementation - `loop` (`str`, default `"auto"`): Event loop implementation: "auto", "asyncio", "uvloop", "zuvloop" (CPython 3.14+, installed separately), "none". Example: `uvicorn.run("main:app", loop="uvloop")` - `http` (`str`, default `"auto"`): HTTP protocol implementation: "auto", "h11", "httptools", "zttp" (experimental, requires the zttp package). Example: `uvicorn.run("main:app", http="httptools")` - `http2` (`bool`, default `False`): Enable experimental HTTP/2. Requires http="zttp". h2c upgrade and WebSockets over HTTP/2 are not supported. See [HTTP/2](https://uvicorn.run/https/#http2). Example: `uvicorn.run("main:app", http="zttp", http2=True)` - `ws` (`str`, default `"auto"`): WebSocket protocol implementation: "auto", "none", "websockets-sansio", "wsproto", "websockets" (legacy, deprecated). "auto" picks websockets-sansio when websockets is installed. Example: `uvicorn.run("main:app", ws="wsproto")` - `lifespan` (`str`, default `"auto"`): Lifespan protocol implementation: "auto", "on", "off". Example: `uvicorn.run("main:app", lifespan="off") # no startup or shutdown events` - `interface` (`str`, default `"auto"`): Application interface type: "auto", "asgi3", "asgi2", "wsgi". "wsgi" is deprecated, wrap WSGI apps with a2wsgi instead. Example: `uvicorn.run(App, interface="asgi2")` - `h11_max_incomplete_event_size` (`int`, default `16384`): Maximum size of incomplete HTTP events buffer (h11 only). Example: `uvicorn.run("main:app", http="h11", h11_max_incomplete_event_size=65536)` ### WebSocket Settings - `ws_max_size` (`int`, default `16777216`): Maximum WebSocket message size in bytes (16 MB). Example: `uvicorn.run("main:app", ws_max_size=1024 * 1024) # 1 MB` - `ws_max_queue` (`int`, default `32`): Maximum WebSocket receive queue length (legacy websockets implementation only). Example: `uvicorn.run("main:app", ws="websockets", ws_max_queue=64)` - `ws_ping_interval` (`float | None`, default `20.0`): WebSocket ping interval in seconds. Example: `uvicorn.run("main:app", ws_ping_interval=30.0)` - `ws_ping_timeout` (`float | None`, default `20.0`): WebSocket ping timeout in seconds. Example: `uvicorn.run("main:app", ws_ping_interval=30.0, ws_ping_timeout=10.0)` - `ws_per_message_deflate` (`bool`, default `True`): Enable WebSocket per-message compression (legacy websockets implementation only). Example: `uvicorn.run("main:app", ws="websockets", ws_per_message_deflate=False)` ### HTTP Settings - `root_path` (`str`, default `""`): Set the ASGI root_path for applications mounted at a subpath. Example: `uvicorn.run("main:app", root_path="/api")` - `proxy_headers` (`bool`, default `True`): Trust X-Forwarded-Proto and X-Forwarded-For from the IPs in forwarded_allow_ips. Example: `uvicorn.run("main:app", proxy_headers=False) # not behind a proxy` - `forwarded_allow_ips` (`str | list`, default `"127.0.0.1"`): Comma-separated list of trusted proxy IPs, networks or UNIX socket paths. Reads $FORWARDED_ALLOW_IPS if set, else trusts "127.0.0.1" and "::1". Use "*" to trust all. Example: `uvicorn.run("main:app", forwarded_allow_ips="10.0.0.0/8") # load balancers` - `server_header` (`bool`, default `True`): Include "Server" header in responses. Example: `uvicorn.run("main:app", server_header=False) # don't advertise uvicorn` - `date_header` (`bool`, default `True`): Include "Date" header in responses. Example: `uvicorn.run("main:app", date_header=False)` - `headers` (`list[tuple[str, str]]`): Custom HTTP headers to add to all responses. ```python uvicorn.run( "main:app", headers=[ ("X-Frame-Options", "DENY"), ("X-Content-Type-Options", "nosniff"), ], ) ``` ### HTTPS / SSL - `ssl_keyfile` (`str`): Path to SSL key file for HTTPS support. See [HTTPS](https://uvicorn.run/https/). Example: `uvicorn.run("main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem")` - `ssl_certfile` (`str`): Path to SSL certificate file for HTTPS support. Example: `uvicorn.run("main:app", ssl_certfile="cert.pem", ssl_keyfile="key.pem")` - `ssl_keyfile_password` (`str`): Password to decrypt the SSL key file if encrypted. ```python uvicorn.run( "main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem", ssl_keyfile_password=os.environ["SSL_KEY_PASSWORD"], ) ``` - `ssl_version` (`int`, default `ssl.PROTOCOL_TLS_SERVER`): SSL protocol version to use. To set a minimum TLS version, use [ssl_context_factory](https://uvicorn.run/parameters/#ssl_context_factory). ```python uvicorn.run( "main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem", ssl_version=ssl.PROTOCOL_TLS_SERVER, # negotiates the best version ) ``` - `ssl_cert_reqs` (`int`, default `ssl.CERT_NONE`): Whether client certificates are required. See [mutual TLS](https://uvicorn.run/https/#mutual-tls). ```python uvicorn.run( "main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem", ssl_cert_reqs=ssl.CERT_REQUIRED, ssl_ca_certs="client-ca.pem", ) ``` - `ssl_ca_certs` (`str`): Path to CA certificates file for client certificate verification. ```python uvicorn.run( "main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem", ssl_cert_reqs=ssl.CERT_REQUIRED, ssl_ca_certs="client-ca.pem", # CA that signed the client certificates ) ``` - `ssl_ciphers` (`str`, default `None`): SSL ciphers to use, in OpenSSL cipher list format. None keeps OpenSSL's safe defaults. ```python uvicorn.run( "main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem", ssl_ciphers="ECDHE+AESGCM:ECDHE+CHACHA20", ) ``` - `ssl_context_factory` (`Callable`): Function receiving (config, default_ssl_context_factory) and returning an ssl.SSLContext. Use it for mTLS, a minimum TLS version or in-memory certificates. Must be picklable with reload or workers. See [custom SSL context](https://uvicorn.run/https/#ssl-context-factory). ```python uvicorn.run( "main:app", ssl_keyfile="key.pem", ssl_certfile="cert.pem", ssl_context_factory=tls13_only, ) ``` ### Resource Limits - `limit_concurrency` (`int`): Maximum number of concurrent connections or tasks before answering HTTP 503. Example: `uvicorn.run("main:app", limit_concurrency=1000)` - `limit_max_requests` (`int`): Maximum number of requests per worker before terminating and respawning. Example: `uvicorn.run("main:app", workers=4, limit_max_requests=10000) # caps leaks` - `limit_max_requests_jitter` (`int`, default `0`): Jitter to add to limit_max_requests to stagger worker restarts and avoid all workers restarting simultaneously. ```python uvicorn.run( "main:app", workers=4, limit_max_requests=10000, limit_max_requests_jitter=1000, # restart between 10000 and 11000 ) ``` - `backlog` (`int`, default `2048`): Maximum number of pending connections in the connection backlog. Example: `uvicorn.run("main:app", backlog=4096)` ### Timeouts - `timeout_keep_alive` (`int`, default `5`): Timeout in seconds for keep-alive connections. Behind a load balancer, set it above the balancer's idle timeout. Example: `uvicorn.run("main:app", timeout_keep_alive=75) # AWS ALB idle timeout is 60s` - `timeout_graceful_shutdown` (`int`, default `None`): Timeout in seconds for graceful shutdown. After this time, connections are forcefully closed. None waits for them. Example: `uvicorn.run("main:app", timeout_graceful_shutdown=25) # Kubernetes waits 30s` ## Real-World Examples Page: https://uvicorn.run/examples/ ### Production Configuration Multiple workers, quieter logs, trusted proxies and worker recycling. Behind a reverse proxy that terminates TLS, drop the `ssl_*` arguments. ```python import uvicorn import os if __name__ == "__main__": uvicorn.run( "app.main:app", host="0.0.0.0", port=int(os.getenv("PORT", 8000)), workers=int(os.getenv("WEB_CONCURRENCY", 4)), log_level="warning", access_log=False, proxy_headers=True, forwarded_allow_ips=os.getenv("TRUSTED_PROXIES", "127.0.0.1"), limit_max_requests=10000, # Recycle workers to prevent memory leaks limit_max_requests_jitter=1000, # Stagger worker restarts timeout_graceful_shutdown=30, ssl_keyfile="./ssl/key.pem", ssl_certfile="./ssl/cert.pem" ) ``` ### Development with Auto-Reload With `reload=True`, the app must be passed as an import string so the reloader can import it again. Install `watchfiles` (included in `uvicorn[standard]`) to use `reload_includes` and `reload_excludes`. ```python import uvicorn if __name__ == "__main__": uvicorn.run( "app.main:app", host="127.0.0.1", port=8000, reload=True, reload_dirs=["./app"], reload_includes=["*.py", "*.html"], log_level="debug" ) ``` ### Config and Server Objects `uvicorn.run()` is a thin wrapper around `Config` and `Server`. Use them directly to start the server inside an existing event loop. ```python import uvicorn from uvicorn.config import Config from uvicorn.server import Server async def run_server(): config = Config( "app.main:app", host="0.0.0.0", port=8000, log_level="info", access_log=True, use_colors=True ) server = Server(config) await server.serve() if __name__ == "__main__": import asyncio asyncio.run(run_server()) ``` ### Factory Mode (Application Factory) With `factory=True`, uvicorn calls the function to build the app, in each worker and after each reload. ```python import uvicorn # In app/main.py: # def create_app(): # app = FastAPI() # # Configure app with dependencies # return app if __name__ == "__main__": uvicorn.run( "app.main:create_app", factory=True, # Treat as factory function host="0.0.0.0", port=8000, reload=True ) ``` ### Environment-Based Configuration Keep one entry point and switch settings with an environment variable. ```python import uvicorn import os def get_config(): if os.getenv("ENVIRONMENT") == "production": return { "host": "0.0.0.0", "port": int(os.getenv("PORT", 8000)), "workers": int(os.getenv("WORKERS", 4)), "log_level": "warning", "access_log": False } else: return { "host": "127.0.0.1", "port": 8000, "reload": True, "log_level": "debug" } if __name__ == "__main__": config = get_config() uvicorn.run("app.main:app", **config) ``` ### Testing Environment Start a real server in a background thread for end-to-end tests. ```python import uvicorn import threading import time def start_test_server(): uvicorn.run( "tests.app:app", host="127.0.0.1", port=8001, log_level="critical", access_log=False ) # Start server in background for testing server_thread = threading.Thread(target=start_test_server, daemon=True) server_thread.start() time.sleep(1) # Wait for server to start # Run your tests here ``` ### More Examples - [HTTPS, mutual TLS, custom SSL contexts and HTTP/2](https://uvicorn.run/https/) - [Workers, reverse proxies, UNIX sockets, Gunicorn and graceful shutdown](https://uvicorn.run/deployment/) ## HTTPS, TLS and HTTP/2 Page: https://uvicorn.run/https/ ### Serving HTTPS Pass a certificate and its private key. Uvicorn builds the `SSLContext` from the `ssl_*` parameters, all listed in the [parameters reference](https://uvicorn.run/parameters/#https-ssl). In most production setups a reverse proxy terminates TLS instead. ```python import uvicorn if __name__ == "__main__": uvicorn.run( "app.main:app", host="0.0.0.0", port=8443, ssl_keyfile="./ssl/key.pem", ssl_certfile="./ssl/cert.pem", ssl_keyfile_password=None, # set it if the key is encrypted ) ``` ### Client Certificates (Mutual TLS) Require clients to present a certificate signed by your CA with `ssl_cert_reqs` and `ssl_ca_certs`. ```python import ssl import uvicorn if __name__ == "__main__": uvicorn.run( "app.main:app", host="0.0.0.0", port=8443, ssl_keyfile="./ssl/key.pem", ssl_certfile="./ssl/cert.pem", ssl_cert_reqs=ssl.CERT_REQUIRED, # reject clients without a valid certificate ssl_ca_certs="./ssl/client-ca.pem", # CA that signed the client certificates ) ``` ### Custom SSL Context Since uvicorn 0.47.0, `ssl_context_factory` covers what the `ssl_*` parameters can't: a minimum TLS version, custom `SSLContext.options`, certificates loaded from memory. It receives the `Config` and a default factory that builds the usual context. The factory runs in each worker process, so with `reload` or `workers` it must be picklable (a top-level function, not a lambda). ```python import ssl from collections.abc import Callable import uvicorn from uvicorn.config import Config # Must be a top-level function so it can be pickled with reload/workers def ssl_context_factory(config: Config, default_ssl_context_factory: Callable[[], ssl.SSLContext]) -> ssl.SSLContext: context = default_ssl_context_factory() # built from the ssl_* parameters context.minimum_version = ssl.TLSVersion.TLSv1_3 return context if __name__ == "__main__": uvicorn.run( "app.main:app", ssl_keyfile="./ssl/key.pem", ssl_certfile="./ssl/cert.pem", ssl_context_factory=ssl_context_factory, ) ``` ### Experimental HTTP/2 Since uvicorn 0.53.0, the `zttp` HTTP implementation can serve HTTP/2 with `http2=True`. Each connection is served as HTTP/1.1 or HTTP/2 depending on what the client speaks. Uvicorn 0.54.0 added response trailers and `103 Early Hints` (needs `zttp>=0.0.34`). Upgrade-based h2c and WebSockets over HTTP/2 are not supported, and it is not ready for production traffic yet. ```python # pip install "uvicorn" "zttp>=0.0.34" import uvicorn if __name__ == "__main__": uvicorn.run( "app.main:app", http="zttp", # experimental, not for production traffic yet http2=True, # serves HTTP/1.1 and HTTP/2, depending on the client ) ``` ## Deployment & Best Practices Page: https://uvicorn.run/deployment/ ### Workers `workers` starts several processes that share the socket. It can't be combined with `reload`. Since uvicorn 0.51.0, sending `SIGHUP` to the main process restarts the workers one at a time, bringing each replacement up before retiring the old one, so a reload doesn't drop requests. ```python import uvicorn if __name__ == "__main__": uvicorn.run( "app.main:app", host="0.0.0.0", port=8000, workers=4, # defaults to $WEB_CONCURRENCY, or 1 limit_max_requests=10000, # recycle workers to contain memory leaks limit_max_requests_jitter=1000, # so they don't all restart at once timeout_graceful_shutdown=30, ) ``` Since uvicorn 0.50.0, any startup failure (app import error, port already in use, lifespan error) exits with code 3, and the supervisor stops instead of restarting a broken worker forever. Process managers can rely on that exit code. ### Behind a Reverse Proxy `proxy_headers` is on by default, but uvicorn only trusts `X-Forwarded-For` and `X-Forwarded-Proto` from the addresses in `forwarded_allow_ips`: `127.0.0.1` and `::1` unless you set it (or `$FORWARDED_ALLOW_IPS`). Set it to your proxy's IP or network, never `*` when clients can reach uvicorn directly. If the app is mounted under a path, set `root_path`. A UNIX domain socket avoids TCP overhead between the proxy and uvicorn: ```python import uvicorn if __name__ == "__main__": uvicorn.run( "app.main:app", uds="/tmp/uvicorn.sock", # UNIX socket instead of TCP workers=4, log_level="warning", proxy_headers=True, forwarded_allow_ips="*" # Trust all (configure nginx properly) ) ``` ### Gunicorn To run under Gunicorn, use the `uvicorn-worker` package (the `uvicorn.workers` module is deprecated). Gunicorn then manages the processes and `uvicorn.run()` isn't called. Some options, such as `limit_concurrency`, are not supported in this mode. ```bash pip install uvicorn-worker gunicorn app.main:app -w 4 -k uvicorn_worker.UvicornWorker ``` ### Graceful Shutdown Uvicorn handles `SIGINT` and `SIGTERM` itself: it stops accepting connections, waits for in-flight requests up to `timeout_graceful_shutdown`, then runs the lifespan shutdown. To stop a server from your own code, set `server.should_exit = True`. ```python import asyncio import uvicorn async def main(): config = uvicorn.Config("app.main:app", host="0.0.0.0", port=8000, timeout_graceful_shutdown=30) server = uvicorn.Server(config) serve_task = asyncio.create_task(server.serve()) await asyncio.sleep(3600) # or wait for any event: a queue message, a deploy hook... server.should_exit = True # same graceful path as SIGTERM await serve_task if __name__ == "__main__": asyncio.run(main()) ``` ### Best Practices #### Performance & Security - Install with `pip install uvicorn[standard]` for uvloop and httptools performance boost - Use multiple workers in production for CPU-bound tasks (or use Gunicorn as process manager) - Disable access logs in production for better performance (`access_log=False`) - Use environment variables for configuration via `env_file` parameter - Enable SSL/TLS for production deployments with proper certificates - Set appropriate log levels for different environments ("warning" for production) - Use reload only in development environments (never in production) - Configure `forwarded_allow_ips` carefully when behind a proxy - only trust known proxies - Set `limit_max_requests` to recycle workers and prevent memory leaks, and use `limit_max_requests_jitter` to stagger restarts - Configure `timeout_graceful_shutdown` for clean shutdown handling #### Development Tips - Use reload_dirs to watch specific directories for changes - Set debug log level during development (`log_level="debug"`) - Use different ports for different services - Keep development and production configs separate - Use `reload_includes`/`reload_excludes` for fine-grained reload control (requires watchfiles) - Use factory mode (`factory=True`) for apps that need fresh instances on reload #### Deployment Options - Use uvicorn's built-in `workers` option for simple multi-process deployment, and send `SIGHUP` for a rolling restart - Startup failures (import error, port in use, lifespan error) exit with code 3, and the supervisor stops instead of restarting forever - For production, consider using Gunicorn with the `uvicorn-worker` package: `gunicorn -k uvicorn_worker.UvicornWorker` - Place behind a reverse proxy (nginx) for SSL termination, load balancing, and static files - Use UNIX domain sockets (`uds`) for reverse proxy communication to avoid TCP overhead ## Upgrading uvicorn Page: https://uvicorn.run/upgrading/ ### What's New Highlights from recent uvicorn releases that affect `uvicorn.run()` (full list in the [release notes](https://uvicorn.dev/release-notes/)): - **0.54.0**: HTTP/2 response trailers and `103 Early Hints` through ASGI extensions. - **0.53.0**: experimental HTTP/2 with `http="zttp", http2=True`, and support for the `zuvloop` event loop. IPv6 loopback (`::1`) is now trusted by default for proxy headers. - **0.52.0**: experimental `zttp` HTTP/1.1 implementation (`http="zttp"`). Not for production traffic yet. - **0.51.0**: `SIGHUP` restarts workers one at a time, so reloads no longer drop requests. `colorama` is no longer in the `standard` extra. - **0.50.0**: `ws="auto"` now picks `websockets-sansio`. Any startup failure (app import, socket bind, lifespan) exits with code 3. - **0.48.0**: `ssl_ciphers` defaults to `None`, using OpenSSL defaults. - **0.47.0**: new `ssl_context_factory` parameter for custom `SSLContext` setups (mTLS, minimum TLS version...). - **0.45.0**: new `reset_contextvars` parameter, `log_level` is case-insensitive and `log_config` accepts `os.PathLike`. ### Deprecation Notices Be aware of these deprecations when upgrading uvicorn: #### uvicorn.workers module deprecated The `uvicorn.workers` module is deprecated and will be removed in a future release. If you're using Gunicorn with uvicorn workers, migrate to the separate `uvicorn-worker` package: `pip install uvicorn-worker` Then use: `gunicorn -k uvicorn_worker.UvicornWorker` #### Legacy websockets implementation deprecated As of uvicorn 0.50.0 (July 2026), `ws="websockets"` is deprecated and `ws="auto"` picks `websockets-sansio`. Use `ws="websockets-sansio"` or `ws="wsproto"`. `ws_max_queue` and `ws_per_message_deflate` only apply to the legacy implementation. #### Python 3.9 no longer supported As of uvicorn 0.40.0 (December 2025), Python 3.9 support has been dropped. Upgrade to Python 3.10 or later. #### ServerState deprecated from main module As of uvicorn 0.34.1 (April 2025), importing `ServerState` from the main uvicorn module is deprecated. Import it from `uvicorn.server` instead.