Deployment stable & 'Ready', but 502 on all requests — domain and TCP proxy both unreachable
Anonymous
HOBBYOP

a month ago

My deployment builds and starts successfully (Next.js logs "Ready" and stays active/stable, no crashes or restarts), but it's completely unreachable from outside:

Public domain (app-production-d252.up.railway.app) → every request returns 502 "Application failed to respond" within a few ms (HTTP logs confirm this).

A TCP Proxy I created on the same port (3000) is also unreachable from outside (connection timeout).

Internally, Network Flow logs show successful TCP connections to my service on port 3000.

No healthcheck path is configured. Restart policy is "On Failure", and the deployment has NOT been restarting — it's been stable and "Active" for several minutes while all requests still 502.

Tested from multiple networks/devices (wifi, mobile data, VPN off) — same result every time.

Project: uurrooster-app, Service: app (production environment).

Can you check what's happening at the edge/routing level for this service?

$10 Bounty

2 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 28 days ago


Make sure the application is listening on 0.0.0.0 instead of localhost or something else. I'd also make sure the port your URL is mapped to is the same port your application is listening to.


Anonymous
PRO

a month ago

I’d check the bind address and target port first, because this kind of 502 usually happens when Railway can see the container but can’t actually reach the HTTP server properly.

You should make sure Next.js is listening on 0.0.0.0, not just 127.0.0.1.

Try starting it with:

next start -H 0.0.0.0 -p $PORT

Then check what Railway is actually giving your app:

echo $PORT

and confirm the process is listening on that port:

ss -lntp

You should see something like:

0.0.0.0:3000

or whatever value $PORT is using.

I’d also test it from inside the container:

curl http://127.0.0.1:$PORT

and:

curl http://$(hostname -i | awk '{print $1}'):$PORT

If localhost works but the container IP doesn’t, then it’s definitely a bind issue.

If both work, then you should check the Railway domain settings and make sure the target port matches the port your app is actually listening on. For example, if Railway gives you PORT=8080 but your domain is targeting 3000, you’ll keep getting the 502 even though Next.js says Ready.

For the TCP proxy, you should also make sure you’re connecting to the public port Railway assigned to the proxy, not port 3000 directly. Railway forwards that external port to your internal 3000.

If the app is listening on 0.0.0.0, the target port matches, and you can successfully curl the service using the container IP, but the public domain still instantly returns 502, then I’d say you’ve pretty much ruled out the app itself and it’s likely a Railway edge/routing issue.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...