HeadlinesBriefing favicon HeadlinesBriefing.com

SSH's Missing Host Header Problem - exe.dev's Clever Fix

Hacker News •
×

exe.dev faced a unique challenge with SSH access to their virtual machines. Their service uses standard URLs like undefined-behavior.exe.xyz for both web and SSH connections, but unlike HTTP's Host header, SSH lacks a mechanism to route connections when multiple VMs share an IPv4 address.

This created a routing dilemma. While web traffic easily handles address sharing through the Host header, SSH connections provide no equivalent information. The team couldn't assign unique IPv4 addresses to each VM without dramatically increasing costs, and IPv6-only would exclude users on networks that don't support it. The problem was particularly acute because exe.dev offers flat-rate subscriptions with many VMs per user.

Their solution was elegant: a pool of public IPv4 addresses where each VM gets a unique address relative to its owner. Instead of a simple A record, domains resolve to a CNAME pointing to an address like s003.exe.xyz, which maps to a specific IP. When SSH connects, the combination of the user's public key and the source IP uniquely identifies the target VM. This required building custom proxy software and careful IP allocation management, but it maintains the uniform domain behavior users expect while solving the routing problem.