Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions docs/en/docs/advanced/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] *}

Comment thread
montanarograziano marked this conversation as resolved.
The following arguments are supported:

Expand All @@ -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:

Expand Down