25 days ago
My custom domain returns a 502 on every request, even though the domain
is verified, the TLS cert is issued, and the service is healthy. I've
tried the usual fixes and I'm stuck.
WHAT WORKS:
-
The service's own *.up.railway.app URL returns HTTP 200 normally.
The app is healthy and listening on port 3000.
WHAT'S BROKEN:
-
The custom domain returns HTTP 502 with response header
"x-railway-fallback: true". Same edge, same service.
DIAGNOSIS DONE:
-
The CNAME resolves correctly and globally (checked via Google 8.8.8.8
and Cloudflare 1.1.1.1).
-
The _railway-verify TXT record is present and correct.
-
The TLS certificate IS issued — openssl shows the cert subject is my
custom domain. So verification worked.
-
In the dashboard the domain shows a green check with target port 3000.
FIXES ALREADY TRIED (none cleared the 502):
-
Removed and re-added the custom domain several times, updating the DNS
CNAME each time to the new target Railway generated.
-
Redeployed the service.
-
Cleared and re-entered the target port (3000).
So the cert issues fine, but the edge never routes the verified domain to
my service — it keeps serving the fallback. Looks like the domain-to-service
binding isn't attaching. What else should I check, or can this be re-bound?
Setup: Next.js standalone via Dockerfile (EXPOSE 3000), Singapore region,
GoDaddy DNS.
Pinned Solution
25 days ago
I'd try setting the port to an arbitrary number (eg, 4100) and update the URL to match that as well.
7 Replies
25 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 25 days ago
Status changed to Solved kshitijdave • 25 days ago
25 days ago
By mistake, I clicked on the resolved part; it's still unsolved.
Status changed to Awaiting Railway Response Railway • 25 days ago
25 days ago
Make sure to add a TXT record at _railway-verify.<DOMAIN> where <DOMAIN> is the domain you’re trying to add. If you’re using the API, you can find the content for the record from the verificationToken property under status.
25 days ago
Thanks! The TXT record at _railway-verify. is already added and verified — the certificate actually issued successfully (openssl shows the cert subject is my custom domain). So domain verification is complete.
The remaining issue is AFTER verification: the domain returns 502 with header "x-railway-fallback: true" — the edge isn't routing the verified domain to my service, even though the same service returns 200 on its
*.up.railway.app URL and listens on port 3000.
25 days ago
I'd try setting the port to an arbitrary number (eg, 4100) and update the URL to match that as well.
Status changed to Awaiting User Response Railway • 25 days ago
25 days ago
Thanks, I'll try that setting the target port to an arbitrary number (e.g. 4100) and matching the app to it.
For context, here's what I've already tried that did NOT clear the 502:
- Removed and re-added the custom domain several times (updating the CNAME in GoDaddy to the new target each time)
- Redeployed the service
- Cleared and re-entered the target port (3000)
The cert re-issued fine each time (subject = my domain), but the "x-railway-fallback: true" 502 always comes back. I'll report back after trying the arbitrary-port change.
Status changed to Awaiting Railway Response Railway • 25 days ago
Status changed to Awaiting User Response Railway • 25 days ago
25 days ago
That fixed it! Changing the target port to an arbitrary value (4100) re-bound the domain to my service — the 502/fallback is gone.
Status changed to Awaiting Railway Response Railway • 25 days ago
Status changed to Solved 0x5b62656e5d • 25 days ago
