Skip to content

Instantly share code, notes, and snippets.

@royyanbach
Last active July 9, 2025 11:29
Show Gist options
  • Save royyanbach/a7c9e64700e5c30e4bb95295fdb99aa2 to your computer and use it in GitHub Desktop.
Save royyanbach/a7c9e64700e5c30e4bb95295fdb99aa2 to your computer and use it in GitHub Desktop.
Railway Custom-Domain Limits & Workarounds — Quick Guide

Railway Custom-Domain Limits & Workarounds — Quick Guide

1. The Limitation

  • Hobby plan2 custom-domain “slots” per service.
  • Each hostname you add (www.example.com, admin.example.com, …) counts as one slot.

2. Simple DNS Pointing

Can you just CNAME a sub-domain to <app>.up.railway.app? Yes, but…
Works for HTTP/HTTPS routing. Railway won’t issue/renew TLS for that name because it’s unaware of it.
Good for quick tests. You must supply SSL (e.g. Cloudflare) yourself.

3. One Service, Many Sub-domains (All on Railway)

Use a wildcard.

  1. Delete existing hostnames in Settings ▸ Domains (free your slots).
  2. Add a single wildcard: *.yourdomain.com
  3. Create the DNS records Railway shows:
    • *.yourdomain.com CNAME <value>.up.railway.app
    • _acme-challenge.yourdomain.com CNAME authorize.railwaydns.net
  4. (Optional) use the 2nd slot for the root domain yourdomain.com.

Result → every sub-domain (www, admin, api, …) reaches the same service over HTTPS, all within the free limit.

4. Mix & Match: Some Sub-domains on Railway, Others Elsewhere

  1. Keep the wildcard setup above (costs 1 slot).

  2. In your DNS zone, add explicit records that override the wildcard:

    four.yourdomain.com   A      <static-IP>
    docs.yourdomain.com   CNAME  docs.example.net
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment