Skip to content

Commit b228ca3

Browse files
committed
security docs for TRUSTED_HOSTS
1 parent ff64079 commit b228ca3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/web-security.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,27 @@ values (or any values that need secure signatures).
269269
.. _samesite_support: https://caniuse.com/#feat=same-site-cookie-attribute
270270

271271

272+
Host Header Validation
273+
----------------------
274+
275+
The ``Host`` header is used by the client to indicate what host name the request
276+
was made to. This is used, for example, by ``url_for(..., _external=True)`` to
277+
generate full URLs, for use in email or other messages outside the browser
278+
window.
279+
280+
By default the app doesn't know what host(s) it is allowed to be accessed
281+
through, and assumes any host is valid. Although browsers do not allow setting
282+
the ``Host`` header, requests made by attackers in other scenarios could set
283+
the ``Host`` header to a value they want.
284+
285+
When deploying your application, set :data:`TRUSTED_HOSTS` to restrict what
286+
values the ``Host`` header may be.
287+
288+
The ``Host`` header may be modified by proxies in between the client and your
289+
application. See :doc:`deploying/proxy_fix` to tell your app which proxy values
290+
to trust.
291+
292+
272293
Copy/Paste to Terminal
273294
----------------------
274295

0 commit comments

Comments
 (0)