...
 
Commits (2)
......@@ -53,15 +53,16 @@
{% if domain != "" %}
The site you tried to access is not reachable by IPv4.
To access <a href="{{ back_to_url }}" target="_blank">{{ domain }}</a>
{% else %}this part of the Internet{% endif %}, you need to enable
IPv6 on your computer.
{% else %}this part of the Internet{% endif %},
you need to enable IPv6 on your computer.
<br>
Find
out
<a href="https://ungleich.ch/en-us/cms/blog/2019/02/05/how-to-get-ipv6/">
how to enable IPv6</a>
or
<a href="https://redmine.ungleich.ch/projects/open-infrastructure/wiki/How_to_disable_IPv4_on_your_website">How
to use this service for your IPv6 only service.</a>
<a href="https://redmine.ungleich.ch/projects/open-infrastructure/wiki/How_to_disable_IPv4_on_your_website">how
to use this service</a> for your IPv6 only service.
</p>
</div>
<footer class="center">
......
......@@ -2,6 +2,7 @@ from urllib.parse import urlsplit
from django.views.generic import TemplateView
import re
# Create your views here.
......@@ -16,7 +17,9 @@ class IndexView(TemplateView):
if "back_to" in self.request.GET:
back_to_url = self.request.GET["back_to"]
elif 'HTTP_HOST' in self.request.META:
back_to_url = "http://{}".format(self.request.META['HTTP_HOST'])
# Exclude ourselves
if not re.match("^no-ipv4-here.ungleich.ch", self.request.META['HTTP_HOST']):
back_to_url = "http://{}".format(self.request.META['HTTP_HOST'])
context['back_to_url'] = back_to_url
if back_to_url != "":
context['domain'] = (urlsplit(back_to_url)).netloc
......