NGINX persistent connection

rafael.silva nginx-forum at forum.nginx.org
Thu Apr 15 19:27:06 UTC 2021


Hi.

Is it possible for me to persist a connection?

Reason... I use NGINX with Swarm, proxy_pass with resolved.
When I have a service with multiple containers, the service cloudcmd does
not work because it does not accept replication, because swith each request,
Swarm delivers a different IP.

Is it possible to do an upstream that takes an IP and fixes it until it is
down? I tried to use keepalived but it didn't work well.

I tried to do this configuration, but kept picking up multiples IP
https://www.nginx.com/blog/dns-service-discovery-nginx-plus/

My code:
http {
  ...
  resolver 127.0.0.11 valid=5s;
  ...
  server {
    set $upstream site;
    location /cloudcmd/ {
      proxy_pass http://site:8000;
    }
    location {
      proxy_pass http://site;
    }
}

Thanks.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,291271,291271#msg-291271



More information about the nginx mailing list