Configuration

Custom Domain

Connect your own domain to Trackr with Caddy and DNS

Overview

By default Trackr runs on localhost. To serve it on your own domain, you need to configure DNS records, update environment variables, and set up a reverse proxy with Caddy.

DNS Records

Point your domain and API subdomain to your server’s IP address. Add these DNS records at your domain registrar or DNS provider:

TypeNameValue
A@your-server-ip
Aapiyour-server-ip

Replace your-server-ip with the public IP of your server. If you use IPv6, add AAAA records as well.

Environment Variables

Update the following variables in your .env file to match your domain:

SUPABASE_PUBLIC_URL=https://api.example.com
API_EXTERNAL_URL=https://api.example.com
SITE_URL=https://example.com
ADDITIONAL_REDIRECT_URLS=https://example.com/auth/callback

Replace example.com with your actual domain.

Caddyfile

The included Caddyfile handles HTTPS automatically via Let’s Encrypt, reverse proxies the app and API, and configures CORS. Update the domain references in your Caddyfile to match your own domain:

example.com {
    reverse_proxy app:3000
}

api.example.com {
    @preflight method OPTIONS
    handle @preflight {
        header Access-Control-Allow-Origin "https://example.com"
        header Access-Control-Allow-Methods "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS"
        header Access-Control-Allow-Headers "Accept, Authorization, Content-Type, apikey, x-client-info, x-supabase-api-version, Prefer, Range, Accept-Profile, Content-Profile, x-upsert"
        header Access-Control-Allow-Credentials "true"
        header Access-Control-Max-Age "3600"
        respond "" 204
    }

    handle {
        reverse_proxy kong:8000 {
            flush_interval -1
            header_down -Access-Control-Allow-Origin
            header_down -Access-Control-Allow-Credentials
            header_down -Access-Control-Allow-Methods
            header_down -Access-Control-Allow-Headers
            header_down -Access-Control-Expose-Headers
            header_down -Access-Control-Max-Age
        }
        header Access-Control-Allow-Origin "https://example.com"
        header Access-Control-Allow-Credentials "true"
        header Access-Control-Expose-Headers "Content-Range, X-Supabase-Api-Version"
    }
}

Replace every occurrence of example.com with your actual domain.

Apply Changes

After updating DNS, your .env, and the Caddyfile, restart all services:

docker compose down && docker compose up -d

Allow a few minutes for DNS propagation and for Caddy to provision your SSL certificates. You can then access Trackr at https://example.com.

ende