What is the correct private networking address?
msoutopico
HOBBYOP

10 months ago

> Project ID: 242eb0e5-3dee-4515-ae8f-b0f7dffc2fa1

Hi there. I have two services in my project: a backend (API) and a frontend (Streamlit web app). The API is deployed on port 8000. I want my API to be reachable publicly but I'm also try to connect my web app internally to it through the private address.

  • The settings of the backend service give me the veryfire-api.railway.internal address (or just veryfire-api) for private networking

  • My web app is trying to reach the API on [http://veryfire-api.railway.internal:8000/v1](http://veryfire-api.railway.internal:8000/v1) -- I have tried with http and https and with and without the :8000 port suffix.

Still my web app is unable to connect and gives me this error:

HTTPConnectionPool(host='veryfire-api.railway.internal', port=8000): Max retries exceeded with url: /v1/token (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))

The docs but give much info, I'm beating about the bush a bit but perhaps someone who users private networking can give me a hand?

It works fine if I use the public/external address (both from my web app and other clients). Not a huge problem but it would be nice if I could make private networking work.

Thanks in advance.
Cheers! Manuel
<#1006629907067064482>

Solved

10 Replies

msoutopico
HOBBYOP

10 months ago

What is the correct private networking address?


uxuz
MODERATOR

10 months ago

Ideally, you should reference your backend url using a service variable like BACKEND_URL=[http://${{service.RAILWAY_PRIVATE_DOMAIN}}:${{service.PORT](http://${{service.RAILWAY_PRIVATE_DOMAIN}}:${{service.PORT)}}


uxuz
MODERATOR

10 months ago

Furthermore, since private networking is IPv6 only, did you make sure that your backend also listens to IPv6?


msoutopico
HOBBYOP

10 months ago

thanks @uxuz I'll try with that variable


msoutopico
HOBBYOP

10 months ago

about IPv6, I thought whether that could be the problem, but I don't know how to check that. would that ber something to check in the Railway deployment or in the code of my FastAPI app?



msoutopico
HOBBYOP

10 months ago

thanks, I think think this can be helpful!


msoutopico
HOBBYOP

10 months ago

I have changed the custom start command to uvicorn code.main:app --host :: --port ${PORT-3000} --workers=4 and it seems to work both for private and public networking! Hurray! thanks a lot @uxuz


uxuz
MODERATOR

10 months ago

You are welcome! I'll go ahead and mark this thread as solved.


uxuz
MODERATOR

10 months ago

!s


Status changed to Solved uxuz 10 months ago


Loading...