I went to configure my dns settings to point all subdomains of localhost (foo.localhost) to localhost but I found it was already working like this.
How is this done on Fedora? I don't believe the hosts file supports this.
Fedora (and recent versions of Ubuntu, for example) use
systemd-resolved as the name resolver. For any name ending in
.localhost (or in
systemd-resolved will promptly return 127.0.0.1. It will also synthesize DNS records for the local hostname, and for the special name
gateway; that is, for those names it won't query the configured DNS servers but rather return immediately with the appropriate address.