Private Network Fails

I have 4 services the fourth one is nginx reverse-proxy. Two services are dockerized, the other service is straight nodejs. Now the NodeJs works well, I call the service name with a port number, but calling the other two dockerized fail. I tried entering the whole DNS
api.railway.internal
api.railway.internal
but it doesn't work. What should I do? I am using NGINX, so here is basic config I want to achieve
upstream api_service {
server api.railway.internal:5000 fail_timeout=120;
}
upstream api_service {
server api.railway.internal:5000 fail_timeout=120;
}
Then I can use it in a location block
location /api {
proxy_pass http://api_service
}
location /api {
proxy_pass http://api_service
}
5 Replies
Percy
Percy7mo ago
Project ID: N/A
nejat-njonjo
nejat-njonjo7mo ago
N/A
Brody
Brody7mo ago
nginx is hard to do correctly with the private network, instead I recommend using caddy, here's a template that likely does what you want - https://railway.app/template/7uDSyj
nejat-njonjo
nejat-njonjo7mo ago
Alright thanks thanks bro When sending requests to this
api.example.com/v1
api.example.com/v1
I want this to proxy to api.railway.internal:3000/api/v1
api.example.com/v1/groove
api.example.com/v1/groove
I want this to proxy to groove.railway.internal:5000/api/v1 Am try caddy but am totally new to so my config is messed up, nothing is working
Brody
Brody7mo ago
show me your caddyfile please
Want results from more Discord servers?
Add your server