Deployed backend API returns 404 – /health works, but /api/* routes blocked by Railway edge
ozghtc
HOBBYOP

6 months ago

Hi Railway team,

I'm hosting a Node.js Express API on Railway. My app boots successfully, listens to process.env.PORT, and routes are defined properly.

The /health endpoint returns 200 OK

But all functional routes like /api/v1/users return 404 Not Found

Locally, the app works and returns proper responses. On Railway, the logs confirm the server is running and the /api/v1/users route is active.

Additionally, in the Postgres logs, I see:

This suggests that your health check or CDN layer may be mistakenly sending HTTP requests to the Postgres port or misrouting requests entirely.

My suspicion: Railway Edge/CDN is blocking or misrouting valid requests to the backend — possibly due to platform-level misconfiguration.

App: https://hzmbackendveritabani-production.up.railway.app

Repo: (can be shared if needed)

Please assist in fixing this routing issue.

Thank you.

Attachments

Under Review$10 Bounty

0 Threads mention this feature

4 Replies

brody
EMPLOYEE

6 months ago

Hello,

We do not block any routes under any circumstances, we are also not mistakenly sending requests to Postgres, an HTTPs application and a TCP application use entirely different routing subsystems.

I've bountied this this so that the community can help debug your application level issue.

Best,

Brody


smolpaw
HOBBY

6 months ago

The url you posted is inaccessible. Let me take a look at your code. I work with express in daily basis. If you can add me the repo and i will debug then open a pull request with the changes
Railway will certainly not send http requests to a postgres instance. It's possible your application is trying to connect to it incorrectly
Then the route returning 404 is a different issue in itself.


sim
FREE

6 months ago

Can you post your express server set up?


sim
FREE

6 months ago

If it is mounted on a subpath like the /api/v1/.. then you will have to access it accordingly


Loading...