Check if host header is present and set back_to_url accordingly

This commit is contained in:
PCoder 2019-01-27 16:39:55 +01:00
parent c098d7a497
commit 406c785233

View file

@ -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, <a href="{domain}">this part of domain</a> is not reachable by IPv4.