People who frequent this blog know I love self hosting. I’m hosting like a dozen of services from home. The pain is accessing these services on the go. In India, CG-NAT is norm and getting a static IPv4 address is expensive. So I’m left with few options to access these services like VPN, third party tunnels or use IPv6.

Now I get why a lot of self hosters prefer VPNs but I think they are just too much work for home use. Not to mention I would have to setup a private server to expose my home VPN network as I’m on CG-NAT 1. I’m not a fan of third party tunnels either. So I’m left with plain IPv6 approach. Fortunately I get IPv6 at home and on mobile as well. Technically I should be able to access the services at home without much hassle. But then security wise I’m exposing my server to all sorts of bots and bad actors.

Solution? Expose services on IPv6 with mTLS enabled reverse-proxy. mTLS ensures that only authenticated clients can connect to my home server. It achieves this by requesting client a pre-issued certificate. If the certificate is valid, the reverse-proxy allows connection to the backend service. Here’s a good resource that shows how to create your own CA and obtain the needed certs. The article is for nginx but I use caddy. mTLS config for caddy is quite simple:

https://yourdomain.com {
	tls your@email.com{                  # allows SSL connection
		client_auth {                               # mTLS config block
			mode require_and_verify
			trusted_ca_cert_file /etc/caddy/certs/private-ca.crt
		}	
	}
	reverse_proxy :5006
}

Like with everything there are some disadvantages of this method. The major one is you have to access most of your services via browser only because lot of mobile apps do not support mTLS auth. Another one is you can’t access your services from network that does not support IPv6. The 2nd one is non-issue for me. I am mitigating the first one by using apps that do support mTLS or I use the web version only.


  1. I tried setting up IPv6 only VPN but again it was complicating things. ↩︎