Wildcard Hostnames
Wildcard hostnames let one vhost handle all subdomains of a domain.
Basic Usage
[[vhost]]
hostnames = ["*.example.com"]
root = "/static"This matches:
blog.example.comapp.example.comstaging.app.example.com
What Wildcards Do NOT Match
Wildcards only match subdomains. The apex domain itself is not matched:
[[vhost]]
hostnames = ["*.example.com"]
root = "/static/wildcard"
[[vhost]]
hostnames = ["example.com"]
root = "/static/apex"sub.example.com→ served from/static/wildcardexample.com→ served from/static/apex
Matching Priority
When a request arrives, Rustinx checks vhosts in this order:
- Exact match:
blog.example.comdefined as an exact hostname - Wildcard match:
*.example.compattern - Catch-all:
_hostname
This means you can override specific subdomains:
# Specific subdomain with SPA
[[vhost]]
hostnames = ["app.example.com"]
root = "/static/app"
spa = true
# Everything else
[[vhost]]
hostnames = ["*.example.com"]
root = "/static/default"Wildcard Rules
- The wildcard must be
*.followed by at least two DNS labels *.example.comis valid*.comis rejected (too broad)*.co.ukis valid- Only one wildcard per hostname entry
Trailing Dot Normalization
DNS fully-qualified domain names end with a dot (example.com.). Rustinx normalizes these automatically. A request with Host: example.com. matches the vhost for example.com.
