Project

General

Profile

Actions

How to disable IPv4 on your website

Status

This document is IN PRODUCTION.

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.

TL;DR

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.

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:

; 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

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

Sample nginx configuration for disabling IPv4 traffic

Assuming that you want to disable

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;
    }
    ...
}

Checkout our blog entry about nginx/geo detection for more information about the nginx configuration.

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.

Updated by Nico Schottelius 8 months ago · 7 revisions