Exposing Code-Server on a VPN
I have all my computers in a Tailscale VPN which means I can see them all as if I were directly connected to them.
Recently I got a new desktop computer which is, for my standards, ridiculously fast. So, it makes sense to develop things in it even when I am not in front of it.
Since VS Code is basically a web app, the idea is to use code server running in it and access it via VPN.
Did it work? OH YES.
Performance is practically the same as running VS code locally, similar to using GitHub codespaces.
Did it need any special config?
Just one. To make Chrome stop complaining about "insecure context", it needs to be accessed via HTTPS, even when it's done over a completely encrypted tunnel.
Luckily, it's very, very easy.
- Tailscale handles creating LetsEncrypt certificates for you automatically
- Caddy configures itself automatically to use them when you are accessing a tailscale node!
So, just get caddy, and use this Caddyfile
:
mindy.tailABCDEF.ts.net
reverse_proxy :8088
Yes. Two lines. The ABCDEF part will be different for each tailscale network.
And that's it. Access it using https://mindy.tailABCDEF.ts.net and ... that's all. I am shocked at how well it worked, and how easy it was.