How to disable IPv4 on your website » History » Version 3
Nico Schottelius, 02/05/2019 03:42 PM
1 | 1 | Nico Schottelius | h1. How to disable IPv4 on your website |
---|---|---|---|
2 | |||
3 | {{toc}} |
||
4 | |||
5 | h2. Status |
||
6 | |||
7 | This document is *IN PROGRESS*. |
||
8 | |||
9 | h2. Introduction |
||
10 | |||
11 | This article is for you, if you want to only allow IPv6 traffic to |
||
12 | your website or some parts of your website. This article is also for |
||
13 | you if you are running a website on an IPv6 only webserver / VM. |
||
14 | |||
15 | 3 | Nico Schottelius | h2. TL;DR |
16 | |||
17 | * For IPv6 only servers add an DNS A entry to 185.203.114.115. |
||
18 | * For Dual stack servers redirect to to https://no-ipv4-here.ungleich.ch/?back_to=https://your-page-here/your-path |
||
19 | |||
20 | 1 | Nico Schottelius | h2. IPv6 only webservers |
21 | |||
22 | If you are running an IPv6 only webserver, IPv4 clients cannot reach |
||
23 | you. They will be presented with an error message from the |
||
24 | browser. |
||
25 | |||
26 | This is clearly not an expected behaviour and your visitors will |
||
27 | likely be confused. |
||
28 | |||
29 | To solve this problem, you can add a DNS "A" entry for your website |
||
30 | pointing to 185.203.114.115. IPv4 only visitors will then be presented |
||
31 | with the content of https://no-ipv4-here.ungleich.ch/ that explains to |
||
32 | them that they need IPv6 to visit your website. |
||
33 | |||
34 | h3. Summary |
||
35 | |||
36 | If you want to help IPv4 visitors to visit IPv6 only websites, you can |
||
37 | add a DNS A entry pointing to 185.203.114.115. Below is the example |
||
38 | code for the BIND DNS server: |
||
39 | |||
40 | <pre> |
||
41 | ; The first one should already be present |
||
42 | example.com. IN AAAA your:ipv6:address:: |
||
43 | |||
44 | ; This one allows visitors to get a hint |
||
45 | example.com. IN A 185.203.114.115 |
||
46 | </pre> |
||
47 | |||
48 | 2 | Nico Schottelius | h2. Dual Stack Webserver: Disabling IPv4 traffic on (parts of) your website |
49 | 1 | Nico Schottelius | |
50 | If you are running a Dual Stack website (reachable by IPv6 and IPv4) |
||
51 | and you want to disable IPv4 traffic, you can redirect the user to |
||
52 | 2 | Nico Schottelius | http://no-ipv4-here.ungleich.ch?back_to=https://www.example.com/your-url |
53 | 1 | Nico Schottelius | |
54 | |||
55 | h3. Sample nginx configuration for disabling IPv4 traffic |
||
56 | |||
57 | Assuming that you want to disable |
||
58 | <pre> |
||
59 | geo $iptype { |
||
60 | 0.0.0.0/0 ipv4; |
||
61 | } |
||
62 | |||
63 | |||
64 | server { |
||
65 | ... |
||
66 | location ~* ^/ipv6/work/(login|logout|signup|jobs)/(.*)$ { |
||
67 | if ($iptype) { |
||
68 | return 302 https://no-ipv4-here.ungleich.ch/?back_to=$scheme://$host$uri; |
||
69 | } |
||
70 | proxy_pass https://www-server.ipv6.work/$1/$2; |
||
71 | } |
||
72 | ... |
||
73 | } |
||
74 | |||
75 | Checkout our |
||
76 | "blog entry":https://ungleich.ch/en-us/cms/blog/2019/01/27/how-to-distinguish-ipv6-and-ipv4-traffic-with-nginx/ |
||
77 | for more information about the nginx configuration. |
||
78 | 3 | Nico Schottelius | |
79 | h3. Changing / Modifying no-ipv4-here.ungleich.ch |
||
80 | |||
81 | 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. |