Skip to content

Domains and HTTPS

  1. Create a DNS A record for the domain pointing at your Hub’s server IP (not the node’s). For example app.example.com → 203.0.113.10.
  2. In the dashboard, Edit the project and set Domain to app.example.com.

Within a few seconds the Hub:

  • adds a route for the domain to nginx on the Hub server,
  • requests a free Let’s Encrypt certificate,
  • switches the domain to HTTPS and redirects http:// to https://.

Traffic then flows: visitor → Hub (nginx) → private network → the node running the app. When the app moves to another node, the route follows it.

Give each project the same Domain and a different Path (in Edit), for example /api/ for one and nothing (the whole domain) for another. The Hub serves each under its path and strips the path before the request reaches the app, so a request for https://example.com/api/users arrives at the API project as /users. A domain and path can only belong to one project.

This is how db.asdl.online/rest/v1/ is served: a PostgREST container run as a Hub project with path /rest/v1/, which the Hub can run on any node.

Certificates last 90 days. certbot on the Hub server renews them automatically and nginx reloads to use the new one. To check renewals work:

Terminal window
sudo certbot renew --dry-run

(Older certbot versions wait a random few minutes before starting — that is normal.)

Terminal window
# Does DNS point at the Hub?
dig +short app.example.com
# Which certificate is served, and until when?
echo | openssl s_client -connect app.example.com:443 -servername app.example.com 2>/dev/null \
| openssl x509 -noout -subject -enddate

On the Hub server, the generated routes are in /etc/nginx/asdl-hub.d/routes.conf and the Hub logs every change:

Terminal window
journalctl -u asdl-hub | grep -E "Nginx|Certificate"