How to add custom domain
rbx4
HOBBYOP

2 months ago

I have created a Railway site, and now I want to use my custom domain registered with Squarespace to allow web browsers to load my Railway site when they type in my custom domain in their browser.

Issues:

  1. The Railway app is configured to run on port 8080. Do I need to change it to port 80?
  2. What configuration (CNAME, etc.) do I need to update and to what values for the site to become accessible from the Internet?

I want to be sure I get this right so there is no interruption while I transition from my old hosting provider to Railway.

Solved

6 Replies

Railway
BOT

2 months ago

You do not need to change your app's port from 8080. We handle SSL termination and routing at our edge, so your app can listen on any port internally. When you add a custom domain in your service's Settings under Public Networking, you select port 8080 as the target port. Note that Squarespace DNS does not support CNAME flattening, so if you're adding a root/apex domain (e.g., example.com), you would need to either use a subdomain like www.example.com or point your domain's nameservers to a provider like Cloudflare that supports CNAME flattening. Full instructions are in our custom domains guide.


Status changed to Awaiting User Response Railway about 2 months ago


rbx4
HOBBYOP

2 months ago

How will I know which Railway DNS servers to point to?


Status changed to Awaiting Railway Response Railway about 2 months ago


rbx4
HOBBYOP

2 months ago

The documentation only provides an example, but not the actual server names.


Railway
BOT

2 months ago

We don't provide our own nameservers. The suggestion in the previous reply was to point your Squarespace domain's nameservers to Cloudflare (not Railway), since Cloudflare supports CNAME flattening for root/apex domains. You would sign up for a free Cloudflare account, follow Cloudflare's nameserver setup guide to change your domain's nameservers in Squarespace, then create a CNAME record in Cloudflare pointing to the value provided when you add your custom domain in your service's Settings under Public Networking.


Status changed to Awaiting User Response Railway about 2 months ago


Railway

You do not need to change your app's port from 8080. We handle SSL termination and routing at our edge, so your app can listen on any port internally. When you add a custom domain in your service's Settings under Public Networking, you select port 8080 as the target port. Note that Squarespace DNS does not support CNAME flattening, so if you're adding a root/apex domain (e.g., `example.com`), you would need to either use a subdomain like `www.example.com` or point your domain's nameservers to a provider like Cloudflare that supports CNAME flattening. Full instructions are in our [custom domains guide](https://docs.railway.com/networking/domains/working-with-domains#custom-domains).

daviden90
FREE

2 months ago

i have same issue i changed the subdomain based on your instructions, but txt still has confimred yet, domain became green. i use namecheap


Status changed to Awaiting Railway Response Railway about 2 months ago


Railway
BOT

2 months ago

When you click "+ Custom Domain" in your service's Settings under Public Networking and enter your domain, we provide a unique CNAME target value (in the form xxxx.up.railway.app) specific to your service - this is not a static value listed in docs, it is generated per service and displayed in the dashboard at that step. Since Squarespace doesn't support CNAME flattening for root/apex domains, you would need to either use a subdomain (like www.yourdomain.com) or transfer your DNS management to Cloudflare by changing your nameservers, then create the CNAME record there pointing to that value.


Status changed to Awaiting User Response Railway about 2 months ago


Railway
BOT

2 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway about 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...