Welcome! Log In Create A New Profile

Advanced

NGINX persistent connection

April 15, 2021 03:27PM
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.
Subject Author Posted

NGINX persistent connection

rafael.silva April 15, 2021 03:27PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready