From 406c785233d50a1e0db964ffb873b778b5467cf3 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 27 Jan 2019 16:39:55 +0100 Subject: [PATCH] Check if host header is present and set back_to_url accordingly --- no_ipv4_here/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/no_ipv4_here/views.py b/no_ipv4_here/views.py index 522a581..350b858 100644 --- a/no_ipv4_here/views.py +++ b/no_ipv4_here/views.py @@ -7,6 +7,8 @@ def index(request): back_to_url = "" if "back_to" in request.GET: back_to_url = request.GET["back_to"] + elif 'HTTP_HOST' in request.META: + back_to_url = request.META['HTTP_HOST'] if back_to_url != "": return HttpResponse( """Sorry, this part of domain is not reachable by IPv4.