7 months ago
Problem: Application deploys successfully and runs perfectly on Railway's internal network, but external browser access fails with "can't reach page" errors.
Evidence of Internal Success:
Server starts correctly:

Server listening on 0.0.0.0:5000Railway health checks working:

Health check endpoint called from: 100.64.0.2 RailwayHealthCheck/1.0Database connectivity: Successful
Static file serving: Operational from
/app/dist/publicAll application routes responding internally
External Access Failure:
Browser requests timeout with "can't reach page"
No external traffic reaching application despite internal health check success
Pattern observed: Working deployments become unreachable without code changes ("evening vs morning" instability)
Application Configuration:
Node.js 20.18.1, Express server
Proper server binding:
server.listen(port, host, callback)syntaxExplicit networking config:
"httpPort": 5000, "tcpProxying": falseHealth check endpoint:
/api/healthresponding correctly to internal requests
5 Replies
7 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
7 months ago
Hi mrbryant2761, it seems that the issue with your deployment is that you have not configured the public networking for it. Select the desired service, go to Settings -> Public Networking -> Public. If this does not contain an already-existing link, then click on GENERATE DOMAIN so that you can get a public-facing URL that you can use to visit your server.
Make sure to choose the correct port at which your server is listening.
I hope that helps.
Attachments
7 months ago
As you said that the issue is not with the PUBLIC URL, so can you check whether you have not explicitly defined a host variable along with a port in the node server?
let port = process.env.port || 5000;
app.listen(port); // or you can do: app.listen(port, "0.0.0.0", () => { ... });There is no need to specify the server, as RAILWAY itself handles that, and make it point to 0.0.0.0tcpProxying: false and "httpPort": 5000 in your config or railway.json are usually unnecessary, as I have several node servers deployed, and they work fine without them.
Add a basic route in the server file, and if its already therem, then do provide the snippet of the same (along with the initial configurations of the server file)
clashing
As you said that the issue is not with the PUBLIC URL, so can you check whether you have not explicitly defined a host variable along with a port in the node server?let port = process.env.port || 5000; app.listen(port); // or you can do: app.listen(port, "0.0.0.0", () => { ... });There is no need to specify the server, as RAILWAY itself handles that, and make it point to 0.0.0.0tcpProxying: false and "httpPort": 5000 in your config or railway.json are usually unnecessary, as I have several node servers deployed, and they work fine without them. Add a basic route in the server file, and if its already therem, then do provide the snippet of the same (along with the initial configurations of the server file)
7 months ago
As of this moment the deployment is now working correctly. However, if I make a minor code change and redeploy it will go back to being unreachable via the public URL.
Through log analysis, we discovered the root cause was a 4+ hour propagation delay for external routing after successful builds. The application was always working internally (health checks passed immediately), but external browser access required 4+ hours to establish.
Timeline Evidence:
Build completed: July 29, 19:35:34 UTC
Health checks working: Immediately (internal Railway traffic)
External access started: July 29, 23:47:17 UTC (4 hours later)
Current Server Configuration (as requested):
// Server configuration in server/index.ts
const port = process.env.PORT ? parseInt(process.env.PORT) : 5000;
const host = process.env.HOST || "0.0.0.0";
server.listen(port, host, () => {
console.log(`
Server listening on ${host}:${port}`);
});
// Basic routes example:
app.get('/api/health', (req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
app.get('/api/mode', (req, res) => {
res.json({ mode: 'test', timestamp: new Date().toISOString() });
});
Current railway.json:
{
"networking": {
"httpPort": 5000,
"tcpProxying": false
}
}
Question: Based on your advice, should we:
Remove the explicit host parameter: server.listen(port) instead of server.listen(port, host)?
Remove the networking configuration from railway.json?
The deployment is working now, but we'd like to optimize our configuration for future deployments.
clashing
As you said that the issue is not with the PUBLIC URL, so can you check whether you have not explicitly defined a host variable along with a port in the node server?let port = process.env.port || 5000; app.listen(port); // or you can do: app.listen(port, "0.0.0.0", () => { ... });There is no need to specify the server, as RAILWAY itself handles that, and make it point to 0.0.0.0tcpProxying: false and "httpPort": 5000 in your config or railway.json are usually unnecessary, as I have several node servers deployed, and they work fine without them. Add a basic route in the server file, and if its already therem, then do provide the snippet of the same (along with the initial configurations of the server file)
7 months ago
The host needs to be :: to tell Node to dual stack bind to IPv6 and IPv4. Since the private network is IPv6 only and the public network is IPv4 only, you need to listen on both network types to use both the public and private network at the same time.
