Welcome! Log In Create A New Profile

Advanced

NGINX reset established connection when upstream server goes up again.

Posted by j@nja0 
NGINX reset established connection when upstream server goes up again.
September 21, 2018 09:27PM
Hello, everybody!

So, I have in my NGINX configuration an upstream with 3 server, "A", "B" and "C".
I am using "hash $remote_addr" mode, because I need direct a client’s requests to the same backend.
All is working fine, with only one inconvenient that I would like to solve.
When server "A" goes down, yours requests are send to server "B" or "C", until now that's ok, but when the server "A" goes back, it is like that claim by requests that already were yours end the client need login again. My questions are.


Are there any way to solve?

Are there any way to avoid that requests return to server A?

My NGINX configuration:


upstream firstplay {
hash $remote_addr;
server a.cer.com:443 max_fails=2 fail_timeout=5s;
server b.cer.com:443 max_fails=2 fail_timeout=5s;
server c.cer.com:443 max_fails=2 fail_timeout=5s;
}

server {
listen 443 ssl;
server_name abc.cer.com;
ssl_certificate /etc/ssl/certs/cert.crt;
ssl_certificate_key /etc/ssl/certs/cert.key;
proxy_http_version 1.1;
proxy_ssl_verify_depth 2;
proxy_ssl_session_reuse on;
proxy_connect_timeout 300;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 300;
error_log /var/log/nginx/cer-error.log;

location / {
proxy_pass https://firstplay/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 99
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