Monitors / Serve a status page on its own domain
Serve a status page on its own domain
Give a status page an address such as status.example.com, with HTTPS handled by your reverse proxy.
Since v1.6.5, a status page can be served at the root of its own domain, for example https://status.example.com, in addition to its /status/<address> on the instance.
Uptime Kotlin speaks HTTP only: the certificate is handled by the reverse proxy in front of the instance.
Set it up
- In the editor of the page, fill in Custom domain in the Settings card, for example
status.example.com, then Save. - Point the DNS of that domain at your reverse proxy: a
CNAMEto the host of your instance, or anA/AAAArecord. - Add the domain to your reverse proxy, with a certificate. It must keep the
Hostheader: see Reverse proxy.
Open https://status.example.com: the page shows at /. The list of status pages links to it.
The domain must follow a few rules, checked when you save:
- a domain name such as
status.example.com: no IP address, no port, no path; - one domain per page, and a page per domain;
- not the address of the instance itself;
- not on a private page: a private page cannot have a custom domain.
What a custom domain serves
On a custom domain, Uptime Kotlin only answers the public routes of the page. Login, settings and the rest of the API stay on the main domain, so no session ever lives on a domain you may not control. Any other request is refused with a 404 and NOT_AVAILABLE_ON_CUSTOM_DOMAIN.
Reverse proxy
Traefik
Traefik requests a certificate for each domain listed in the rule of a router: add each custom domain to it. Traefik keeps the Host header by default.
Static configuration, for example in the command of the traefik service, with an HTTP challenge on port 80:
command:
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.websecure.address=:443
- [email protected]
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=webLabels of the uptime-kotlin service: one router for the instance, one for the custom domains.
labels:
- traefik.enable=true
- traefik.http.services.uptime-kotlin.loadbalancer.server.port=8080
# Main domain of the instance
- traefik.http.routers.uptime-kotlin.rule=Host(`uptime.example.com`)
- traefik.http.routers.uptime-kotlin.entrypoints=websecure
- traefik.http.routers.uptime-kotlin.tls.certresolver=letsencrypt
# Custom domains of the status pages
- traefik.http.routers.uptime-kotlin-status.rule=Host(`status.example.com`) || Host(`status.client.com`)
- traefik.http.routers.uptime-kotlin-status.entrypoints=websecure
- traefik.http.routers.uptime-kotlin-status.tls.certresolver=letsencrypt
- traefik.http.routers.uptime-kotlin-status.tls.domains[0].main=status.example.com
- traefik.http.routers.uptime-kotlin-status.tls.domains[1].main=status.client.comWith one tls.domains entry per domain, each gets its own certificate: adding a domain does not renew the others. To add a domain, add it to the rule and to tls.domains, then run docker compose up -d, which recreates the uptime-kotlin container.
To add domains without touching that container, declare the router in a file watched by Traefik instead (--providers.file.directory=/etc/traefik/dynamic and --providers.file.watch=true):
# /etc/traefik/dynamic/status-domains.yml
http:
routers:
uptime-kotlin-status:
rule: Host(`status.example.com`) || Host(`status.client.com`)
entryPoints: [websecure]
service: uptime-kotlin-status
tls:
certResolver: letsencrypt
domains:
- main: status.example.com
- main: status.client.com
services:
uptime-kotlin-status:
loadBalancer:
servers:
- url: http://uptime-kotlin:8080Traefik picks up the change on save, and requests the new certificate.
nginx and Certbot
nginx does not request certificates itself: get one per domain with Certbot, then add a server block.
One block on port 80 for every domain, which answers the Let's Encrypt challenge and redirects the rest to HTTPS:
server { listen 80 default_server; server_name _; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } }Request the certificate of the new domain, once its DNS points at the server:
Terminalcertbot certonly --webroot -w /var/www/certbot -d status.example.comAdd a block for the domain, then reload nginx with
nginx -s reload:server { listen 443 ssl; server_name status.example.com; ssl_certificate /etc/letsencrypt/live/status.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/status.example.com/privkey.pem; location / { proxy_pass http://uptime-kotlin:8080; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 300s; } }
proxy_set_header Host $host; is required: without it, nginx sends the address of proxy_pass and Uptime Kotlin cannot tell which page to serve. Certbot renews the certificates on its own; add --deploy-hook "nginx -s reload" to the command of step 2 so nginx loads the renewed ones.
Coolify and Dokploy
- Coolify: in the uptime-kotlin container of the service, add the domain after the existing one, separated by a comma and with the port, for example
https://uptime.example.com:8080,https://status.example.com:8080, then redeploy. - Dokploy: in the Domains tab, add the domain for the
uptime-kotlinservice, on container port8080, with HTTPS and Let's Encrypt.
Both proxies request the certificate and keep the Host header.
A proxy that changes the Host header
Some proxies, or chains of proxies, send their own Host and put the original one in X-Forwarded-Host. Uptime Kotlin ignores that header by default, because the host chooses which page is served. To read it, set both variables on the uptime-kotlin service:
QUARKUS_HTTP_PROXY_PROXY_ADDRESS_FORWARDING: 'true'
QUARKUS_HTTP_PROXY_TRUSTED_PROXIES: 172.18.0.0/16X-Forwarded-Host is then read only from the listed addresses (IPs or CIDR, comma-separated). Never list addresses that clients can use. See Configuration.
Good to know
- The domain is part of the page in a backup.
- Removing the domain, or the page, stops it from answering right away.
