How to disable IPv4 on your website » History » Revision 6
Revision 5 (Nico Schottelius, 02/05/2019 03:43 PM) → Revision 6/7 (Nico Schottelius, 02/05/2019 03:43 PM)
h1. How to disable IPv4 on your website {{toc}} h2. Status This document is *IN PRODUCTION*. h2. Introduction This article is for you, if you want to only allow IPv6 traffic to your website or some parts of your website. This article is also for you if you are running a website on an IPv6 only webserver / VM. h2. TL;DR * For IPv6 only servers add an DNS A entry to 185.203.114.115. * For Dual stack servers redirect to to https://no-ipv4-here.ungleich.ch/?back_to=https://your-page-here/your-path h2. IPv6 only webservers If you are running an IPv6 only webserver, IPv4 clients cannot reach you. They will be presented with an error message from the browser. This is clearly not an expected behaviour and your visitors will likely be confused. To solve this problem, you can add a DNS "A" entry for your website pointing to 185.203.114.115. IPv4 only visitors will then be presented with the content of https://no-ipv4-here.ungleich.ch/ that explains to them that they need IPv6 to visit your website. h3. Summary If you want to help IPv4 visitors to visit IPv6 only websites, you can add a DNS A entry pointing to 185.203.114.115. Below is the example code for the BIND DNS server: <pre> ; The first one should already be present example.com. IN AAAA your:ipv6:address:: ; This one allows visitors to get a hint example.com. IN A 185.203.114.115 </pre> h2. Dual Stack Webserver: Disabling IPv4 traffic on (parts of) your website If you are running a Dual Stack website (reachable by IPv6 and IPv4) and you want to disable IPv4 traffic, you can redirect the user to http://no-ipv4-here.ungleich.ch?back_to=https://www.example.com/your-url h3. Sample nginx configuration for disabling IPv4 traffic Assuming that you want to disable <pre> geo $iptype { 0.0.0.0/0 ipv4; } server { ... location ~* ^/ipv6/work/(login|logout|signup|jobs)/(.*)$ { if ($iptype) { return 302 https://no-ipv4-here.ungleich.ch/?back_to=$scheme://$host$uri; } proxy_pass https://www-server.ipv6.work/$1/$2; } ... } </pre> Checkout our "blog entry about nginx/geo detection":https://ungleich.ch/en-us/cms/blog/2019/01/27/how-to-distinguish-ipv6-and-ipv4-traffic-with-nginx/ for more information about the nginx configuration. h3. Changing / Modifying no-ipv4-here.ungleich.ch If you want to make changes to the website, you can access the source code of it on https://code.ungleich.ch/ungleich-public/ungleich-no-ipv4-here and submit changes to it.