3 months ago
App responds to internal healthcheck but external requests timeout
1 Replies
Status changed to Awaiting Railway Response Railway • 3 months ago
2 months ago
If the application responds to Railway’s internal health check but external requests are timing out, the most common cause is that the server is not listening on the correct interface or port expected by the platform.
In Railway, services must bind to the port provided by the PORT environment variable and listen on all interfaces.
A common mistake is binding the server to localhost or a fixed port. When this happens, the internal health check may still succeed inside the container, but Railway’s edge proxy cannot reach the application from outside.
Make sure the server is configured like this:
process.env.PORTand listening on 0.0.0.0.
Example (Node / Express):
const port = process.env.PORT || 3000;
app.listen(port, "0.0.0.0", () => {
console.log(`Server running on ${port}`);
});Things to verify:
1. Correct port
Your application must listen on the Railway-provided port instead of a hardcoded one like 3000 or 8080.
2. Binding address
Do not bind to localhost or 127.0.0.1. The server should bind to:
0.0.0.03. No long startup blocking
If the app takes too long to start (e.g., migrations, heavy initialization), the external proxy may timeout even though the container health check passes.
4. Confirm the service actually exposes the port
You can test inside the container shell:
curl http://localhost:$PORTIf that works but the public URL times out, it usually means the app is bound incorrectly or not listening on the correct port.
In most cases, switching the server to use process.env.PORT and binding to 0.0.0.0 resolves the issue.