NGINX cannot find service after redeploy
8weight
PROOP

10 months ago

We use NGINX to reverse proxy to multiple backend services over the private network. Whenever we redeploy one of our services it seems the ipv6 private ip is no longer valid, We have to redeploy NGINX everytime we redeploy another service in order to pick up the correct addresses

Is there anyway to mitigate this issue

Solved

1 Replies

brody
EMPLOYEE

10 months ago

Hello,

IPs on the private network are not static, they change every time you deploy the service in question.

NGINX caches the IP of its upstreams on boot for the duration of its lifetime.

That explains why the proxy connection breaks everytime you deploy an upstream; NGINX still uses the old IP.

Unfortunately, this is just a downside of using NGINX with upstreams that have dynamic IPs.

To fix this, I would highly recommend using Caddy, Caddy has no such issues with dynamic upstreams.

Here is an example with Caddy that should get you 90% of the way there -

https://github.com/railwayapp-templates/caddy-reverse-proxy

Best,

Brody


Status changed to Awaiting User Response Railway 10 months ago


Railway
BOT

6 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 6 months ago


Loading...