Self-hosting: Avoiding hairpin NAT / loopback

Hi everyone,

My small team has been loving grist so far. I am trying to make my version of grist-omnibus accessible both over the local network and at our website.

So local network it’s at http://192.168.1.26:6060, and I’m running Caddy reverse proxy to try to make it available at grist.mywebsite.com. Caddy should handle the https so I’ve set the HTTPS=external in the env variables, and basically my server computer is port forwarded so that URL is also 192.168.1.26:6060, and caddy should handle incoming traffic and redirect it to grist.

My issue is that I can get one or the other working, but not both. If I do it as above, it tries to refer external traffic to 192.168.1.26:6060 from an external network, which obviously doesn’t work because it’s a local ip address and means nothing to the computers outside the network.

However, if I set the URL=grist.mywebsite.com, then I could access it externally, but our router doesn’t allow hairpin NAT so users can’t access grist via grist.mywebsite.com. And they also can’t access via the local IP.

I’m no networking expert though, so I’m wondering if someone has any ideas as to how to solve this? It seems my best option at this point would be to make a split-horizon DNS to allow for internal/external access. I’ve tried it once, but my DNS servers prefer IPv6 and I am a bit concerned to turn off the periodic IPv6 address shifting that windows does for my computer to make it a static IPv6.

Thanks in advance everyone,
Brennan