Runtime V2: Healthcheck succeeds but public domain returns 502 (connection refused)
nibrahimkhanli
FREEOP

25 days ago

Deployment ID:

ee5bc4b2-4aeb-4d30-a878-6080abef4049

Replica:

4da6bcd8-94c0-433a-b842-cb9dab13f81e

Runtime:

Runtime V2

Facts:

Can you investigate why the Edge proxy cannot establish a TCP connection to the active replica even though the process is listening and the healthcheck succeeds?

Solved$10 Bounty

Pinned Solution

You need to change the port from 3000 to 8080 in your service settings. This is the cause of the issue, as traffic is currently being routed to port 3000 as you said.

6 Replies

Railway
BOT

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


Make sure your public URL is mapped to 8080 in your service settings


25 days ago

Your app need to listen to host 0.0.0.0


mayori

~~Your app need to listen to host `0.0.0.0`~~

:: binds on both IPv4 and IPv6.


nibrahimkhanli
FREEOP

25 days ago

Thanks.

A few additional diagnostics:

The application now explicitly calls app.listen(port, "0.0.0.0").

Railway injects PORT=8080.

netstat -ltnp shows Node listening on :::8080.

wget http://127.0.0.1:$PORT/health returns HTTP 200.

wget http://10.173.2.124:8080/health (replica IP) also returns HTTP 200.

Deployment healthcheck succeeds.

The Edge logs still show connection refused for the same replica ID that I'm connected to in the Railway shell.

One thing I noticed is that the Networking page still displays "Port 3000" under the public domain, while the runtime is using PORT=8080.

Is the "Port 3000" value only informational, or could the public domain still be routing to port 3000 instead of the runtime-assigned port?


nibrahimkhanli

Thanks. A few additional diagnostics: The application now explicitly calls app.listen(port, "0.0.0.0"). Railway injects PORT=8080. netstat -ltnp shows Node listening on :::8080. wget http://127.0.0.1:$PORT/health returns HTTP 200. wget http://10.173.2.124:8080/health (replica IP) also returns HTTP 200. Deployment healthcheck succeeds. The Edge logs still show connection refused for the same replica ID that I'm connected to in the Railway shell. One thing I noticed is that the Networking page still displays "Port 3000" under the public domain, while the runtime is using PORT=8080. Is the "Port 3000" value only informational, or could the public domain still be routing to port 3000 instead of the runtime-assigned port?

You need to change the port from 3000 to 8080 in your service settings. This is the cause of the issue, as traffic is currently being routed to port 3000 as you said.


benyoudz
FREE

25 days ago

Can you check your Service Settings → Networking and confirm that the Public Domain is configured to target port 8080 rather than 3000?

If it's currently set to 3000, update it to 8080 and redeploy.

If it's already targeting 8080 and the public endpoint still returns 502 (connection refused) while the healthcheck succeeds, please let us know. That would indicate a platform-side routing issue requiring further investigation.


Status changed to Solved mayori 25 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...