Tested 2026-02-05
| Method | HTTP | Gradio Assets | Browser | Verdict |
|---|---|---|---|---|
Nested subdomainbrain.ui.localhost |
200 OK | Works | Works | ✓ Recommended |
Path-basedtest.localhost/brain/ |
200 OK | Works | Test visually | ✓ Works |
Nested subdomains resolve correctly:
$ ping brain.ui.localhost PING localhost (127.0.0.1)
macOS resolves *.localhost including nested subdomains to 127.0.0.1 (RFC 6761).
Nested subdomain:
brain.ui.localhost {
reverse_proxy localhost:7805
tls internal
}
Path-based:
test.localhost {
tls internal
handle_path /brain/* {
reverse_proxy localhost:7805
}
handle_path /static/* {
reverse_proxy localhost:7940
}
}
Gradio uses relative paths: src="./assets/index-xxx.js"
| Method | Browser resolves to | Result |
|---|---|---|
| Nested | /assets/index-xxx.js |
200 OK |
| Path-based | /brain/assets/index-xxx.js |
200 OK (handle_path catches it) |
Both methods work. Choose based on preference:
| If you want... | Use |
|---|---|
| Clean URLs, easy bookmarking | brain.ui.localhost (nested) |
| Fewer DNS entries, grouped services | ui.localhost/brain/ (path-based) |
| Current setup (works fine) | brain.localhost (flat) |
Config at: /opt/homebrew/etc/Caddyfile