Browse Source
📝 Update includes in `docs/en/docs/advanced/middleware.md` (#12582)
pull/12629/head
Graziano Montanaro
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
9 deletions
-
docs/en/docs/advanced/middleware.md
|
|
@ -57,17 +57,13 @@ Enforces that all incoming requests must either be `https` or `wss`. |
|
|
|
|
|
|
|
Any incoming request to `http` or `ws` will be redirected to the secure scheme instead. |
|
|
|
|
|
|
|
```Python hl_lines="2 6" |
|
|
|
{!../../docs_src/advanced_middleware/tutorial001.py!} |
|
|
|
``` |
|
|
|
{* ../../docs_src/advanced_middleware/tutorial001.py hl[2,6] *} |
|
|
|
|
|
|
|
## `TrustedHostMiddleware` |
|
|
|
|
|
|
|
Enforces that all incoming requests have a correctly set `Host` header, in order to guard against HTTP Host Header attacks. |
|
|
|
|
|
|
|
```Python hl_lines="2 6-8" |
|
|
|
{!../../docs_src/advanced_middleware/tutorial002.py!} |
|
|
|
``` |
|
|
|
{* ../../docs_src/advanced_middleware/tutorial002.py hl[2,6:8] *} |
|
|
|
|
|
|
|
The following arguments are supported: |
|
|
|
|
|
|
@ -81,9 +77,7 @@ Handles GZip responses for any request that includes `"gzip"` in the `Accept-Enc |
|
|
|
|
|
|
|
The middleware will handle both standard and streaming responses. |
|
|
|
|
|
|
|
```Python hl_lines="2 6" |
|
|
|
{!../../docs_src/advanced_middleware/tutorial003.py!} |
|
|
|
``` |
|
|
|
{* ../../docs_src/advanced_middleware/tutorial003.py hl[2,6] *} |
|
|
|
|
|
|
|
The following arguments are supported: |
|
|
|
|
|
|
|