Hi, I'm Max. I've used many hosts file switchers over the years to do local development with real hostnames/domains, combined with HTTPS reverse-proxies.

I made HostsTray to combine both into one tool.

Through a tray icon (Windows) or menu bar (macOS) you can toggle groups of hosts file entries, and toggle the HTTPS proxy.

The HTTPS proxy first installs a local CA cert into your keychain/certificate store, and then uses it to create certificates for each domain that passes through the proxy.

You can configure the proxy to route different paths to different ports locally. Websockets are also supported.

A common problem when editing hosts file is to make Chrome/other browser actually update the DNS cache. I found this is due to Chrome holding a pool of open connections in the background. HostsTray solves this by dropping the open connections to addresses that changed, forcing Chrome to reconnect and re-lookup the hostnames. It is VERY satisfying to toggle a hosts group and see Chrome obey immediately.

Switching can be password-free using an optional helper that runs as admin. The helper only does switching/toggling of groups you already have.

HostsTray also exposes a local API to toggle hosts groups and the proxy. The API also serves a skill suitable for coding agents. So you can let Claude Code toggle for you. It can also add new hostnames to HostsTray, but that requires user verification from you.

The whole thing is a ~10 MB binary written in Go, open-source for Windows and macOS.

Hope this can be useful Feedback is very welcome.


Comments URL: https://news.ycombinator.com/item?id=50517001

Points: 2

# Comments: 0