]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update TrustedHostMiddleware Documentation (#11441)
authorSoul Lee <alus20x@gmail.com>
Sun, 31 Aug 2025 09:59:07 +0000 (18:59 +0900)
committerGitHub <noreply@github.com>
Sun, 31 Aug 2025 09:59:07 +0000 (11:59 +0200)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alejandra <90076947+alejsdev@users.noreply.github.com>
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
docs/en/docs/advanced/middleware.md

index 4ca07676b1bdc86dddb1fa19571ac5b6a840882f..d1be4afffca7ad9840fbe08a2bd8bfe07805a7e8 100644 (file)
@@ -68,6 +68,7 @@ Enforces that all incoming requests have a correctly set `Host` header, in order
 The following arguments are supported:
 
 * `allowed_hosts` - A list of domain names that should be allowed as hostnames. Wildcard domains such as `*.example.com` are supported for matching subdomains. To allow any hostname either use `allowed_hosts=["*"]` or omit the middleware.
+* `www_redirect` - If set to True, requests to non-www versions of the allowed hosts will be redirected to their www counterparts. Defaults to `True`.
 
 If an incoming request does not validate correctly then a `400` response will be sent.