a year ago
Recently i using railway to deploy mail ecommerce app i config front app with variables is private network link railway but my frontend app cant call API how i can config that
http://${{SERVICENAME.RAILWAYPRIVATE_DOMAIN}}:${{api.PORT}}
4 Replies
a year ago
That's simply not how it works, a CSR frontend app would need to call the backend's public domain.
These two docs sections will provide more information -
https://docs.railway.app/guides/private-networking#private-network-context
a year ago
thanks i known if call backend's public domain it work. However as I understand I can call the backend api through private network is that true.Like that
app.get('/fetch-secret', async (req, res) => {
axios.get('http://api.railway.internal:3000/secret')
.then(response => {
res.json(response.data);
})
})
a year ago
Please read over my message again and also read the two docs sections I have linked.
7 months ago
Do i understand correctly that a BACKEND_URL env variable should be something like this?http://${{backend-server.RAILWAY_PUBLIC_DOMAIN}}:${{backend-server.PORT}}