railway domain
Add a custom domain or generate a Railway-provided domain for a service.
Usage
Options
| Flag | Description |
|---|---|
-p, --port <PORT> | The port to connect to the domain |
-s, --service <SERVICE> | The service to add the domain to |
--json | Output in JSON format |
Examples
Generate a Railway domain
Creates a free *.up.railway.app domain for your service.
Add a custom domain
Returns the required DNS records to configure.
Add domain with specific port
Add domain to specific service
Custom domain setup
When adding a custom domain, the CLI displays the required DNS records - a CNAME record and a TXT record. Both are required: the CNAME routes traffic and the TXT verifies domain ownership. Add both to your DNS provider exactly as shown in the CLI output.
Requests to the domain will return a 404 until the TXT record is in place and Railway has verified ownership.
DNS changes can take up to 72 hours to propagate worldwide.
Limits
- One Railway-provided domain per service
- Multiple custom domains can be added per service