How do I create wildcard domains programatically for all my instances?
phukon
HOBBYOP

22 days ago

Hi everyone,

I’m working on automating infrastructure setup across multiple instances and I’m trying to figure out the best way to handle wildcard domains programmatically on Railway.

Goal:
I want every instance/service I spin up to automatically be accessible via a wildcard subdomain, something like:

*.mydomain.com

So instead of manually assigning domains for each deployment, new instances would automatically resolve under a consistent wildcard pattern (for example: instance1.mydomain.com, instance2.mydomain.com, etc.).

$10 Bounty

1 Replies

Add *.mydomain.com as a custom domain on your service so that all subdomains will route there and your app handles routing .If you need to assign some subdomains to different services programmatically, you can use railway's GraphQL API (customDomainCreate mutation).

https://docs.railway.com/guides/manage-domains

https://docs.railway.com/networking/domains


Loading...