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.internaladdress (or justveryfire-api) for private networkingMy 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 withhttpandhttpsand with and without the:8000port 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>
10 Replies
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)}}
10 months ago
Furthermore, since private networking is IPv6 only, did you make sure that your backend also listens to IPv6?
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?
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
10 months ago
You are welcome! I'll go ahead and mark this thread as solved.
10 months ago
!s
Status changed to Solved uxuz • 10 months ago