How do I use private networking with railway generated ports

ciaranevansTRIAL

a year ago

Hey Folks,

As mentioned in the documentation, it's recommended to stick to the ports railway sets on your services, coolio.

When I want to make a request to a service on the internal network however, how can I know the port that Railway has assigned it?

Looking at: https://docs.railway.app/guides/private-networking#use-internal-hostname-and-port

For example, my project: https://github.com/ciaranevans/archivum28

Has a frontend and backend. I know that the internal hostname of my backend is backend.railway.internal - But the port is randomly assigned at runtime, so how would my frontend know what the port is?

Is this a case where I then have to move to explicitly setting ports my services are exposed on?

Solved

2 Replies

ciaranevansTRIAL

a year ago

Also following on from this, the dashboard says:

backend.railway.internal


Ready to talk privately ·
You can also simply call me
backend
.

How would that look in a fetch request?


a year ago


Status changed to Solved railway[bot] over 1 year ago


How do I use private networking with railway generated ports - Railway Help Station