mirror of https://github.com/tiangolo/fastapi.git
📝 Update includes in `docs/en/docs/advanced/middleware.md` (#12582)
This commit is contained in:
parent
f5a10c1c7d
commit
5d99a42688
|
|
@ -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.
|
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 hl[2,6] *}
|
||||||
{!../../docs_src/advanced_middleware/tutorial001.py!}
|
|
||||||
```
|
|
||||||
|
|
||||||
## `TrustedHostMiddleware`
|
## `TrustedHostMiddleware`
|
||||||
|
|
||||||
Enforces that all incoming requests have a correctly set `Host` header, in order to guard against HTTP Host Header attacks.
|
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 hl[2,6:8] *}
|
||||||
{!../../docs_src/advanced_middleware/tutorial002.py!}
|
|
||||||
```
|
|
||||||
|
|
||||||
The following arguments are supported:
|
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.
|
The middleware will handle both standard and streaming responses.
|
||||||
|
|
||||||
```Python hl_lines="2 6"
|
{* ../../docs_src/advanced_middleware/tutorial003.py hl[2,6] *}
|
||||||
{!../../docs_src/advanced_middleware/tutorial003.py!}
|
|
||||||
```
|
|
||||||
|
|
||||||
The following arguments are supported:
|
The following arguments are supported:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue