From 0860db225a4a7059c0884c87c0a7aa0035fd0d36 Mon Sep 17 00:00:00 2001 From: sreehari1997 Date: Thu, 25 Mar 2021 14:13:12 +0530 Subject: [PATCH] Fixed #32580 -- Doc'd that HttpRequest.get_host() may raise DisallowedHost. --- AUTHORS | 1 + docs/ref/request-response.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/AUTHORS b/AUTHORS index 4f55ac0eb9..45a593605b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -855,6 +855,7 @@ answer newbie questions, and generally made Django that much better: sloonz smurf@smurf.noris.de sopel + Sreehari K V Srinivas Reddy Thatiparthy Stanislas Guerra Stanislaus Madueke diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 4f4de1be1c..cc8006f5f7 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -290,6 +290,10 @@ Methods Example: ``"127.0.0.1:8000"`` + Raises ``django.core.exceptions.DisallowedHost`` if the host is not in + :setting:`ALLOWED_HOSTS` or the domain name is invalid according to + :rfc:`1034`/:rfc:`1035 <1035>`. + .. note:: The :meth:`~HttpRequest.get_host()` method fails when the host is behind multiple proxies. One solution is to use middleware to rewrite the proxy headers, as in the following example::