Caddy Routing Test Results

Tested 2026-02-05

Summary

Method HTTP Gradio Assets Browser Verdict
Nested subdomain
brain.ui.localhost
200 OK Works Works ✓ Recommended
Path-based
test.localhost/brain/
200 OK Works Test visually ✓ Works

DNS Resolution

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).

Caddy Config

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
    }
}

Asset Path Resolution

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)

Recommendation

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)

Test URLs

Config at: /opt/homebrew/etc/Caddyfile