Making IPv6 work with Caddy and Hetzner
After a few hours of fiddling, this site is now properly accessible via IPv6.
My configuration uses Caddy as the reverse proxy meaning that it forwards the requests to the right service based on the Host that the browser specifies.
Thanks to this, one server can host hundreds if not thousands of websites from one IP.
In my Caddyfile, I had specified the following
www.huijzer.xyz {
redir https://huijzer.xyz permanent
}
huijzer.xyz {
reverse_proxy 127.0.0.1:3000
}
And then I thought that for IPv6 maybe this last part should have been
huijzer.xyz {
reverse_proxy :3000
}
And I also made my webserver listen on IPv6 now. These changes were not necessary.
What is 100% necessary is to set the correct DNS settings. Hetzner lists the IPv6 in the console as
2a01:4f8:1c1c:c675::/64
So I thought that I should set my DNS setting to
2a01:4f8:1c1c:c675::
which is incorrect.
The correct setting is
2a01:4f8:1c1c:c675::1
Because, according to the Hetzner FAQ, "By default, we assign the first address from this network to the cloud server."