a year 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 networking - My web app is trying to reach the API on
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
a year ago
Ideally, you should reference your backend url using a service variable like BACKEND_URL=http://${{service.RAILWAY_PRIVATE_DOMAIN}}:${{service.PORT}}
a year 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?
a year 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
a year ago
You are welcome! I'll go ahead and mark this thread as solved.
a year ago
!s
Status changed to Solved uxuz • about 1 year ago