a month ago
I have a django app that accepts rest api requests and a react frontend on the same railway project. Using the public domain of django I can seemlessly call fetches and get the data I need. I am trying to use the internal network though for better speed and security but wasnt able to get it to work.
I simply added the priate domain of django to the django allowed hosts, and the react private domain to the allowed origins and csrf. Then I called the domain using fetch in react with http://.
But I then get timout errors. What am I missing here?
44 Replies
a month ago
Private networking URLs are structured as .railway.internal.
a month ago
(no markdown available for this content)
a month ago
Yes.
a month ago
^
a month ago
You used https.
a month ago
Also, you can’t use private networking for frontend code.
a month ago
Clients (machines that access your website) do not have access to private networking.
So it is not directly called from the client, the client calls the internal proxy and the proxy calls the backend
a month ago
Yes.
a month ago
This depends on what port your application is listening to.
(no markdown available for this content)
Attachments
a month ago
Either the application didn’t respond (wrong port?) or your proxy couldn’t resolve it.
a month ago
I assume the frontend is able to reach the proxy successfully?
a month ago
Try SSH-ing into your proxy service and curl -I your private networking URL and see if it can get a OK head response.
a month ago
Right click on your service and Copy SSH Command to get the SSH command. You’ll need Railway CLI installed to use this.
getting this, tried installing with apt but
root@d4c0178c0e9c:/app# apt install curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package curlokay tried node
root@d4c0178c0e9c:/app# node -e "require('http').get('http://backend.railway.internal:8080', (res) => console.log(res.statusCode))"
301a month ago
Right. Sorry.
a month ago
Are you able to see where it’s trying to redirect you to?
a month ago
(I assume you redeployed your service after updating variables?)
(no markdown available for this content)
Attachments
The issue was SECURE_SSL_REDIRECT defaulting to True in the django settings