The problem of nginx redirecting load session

the server does redirect rewrite (. *) http://ip:xxxx/ points to the load server.
there is no redirection before, but ip_hash is used to solve the session problem.
upstream aa {
ip_hash;
server ip1:xxxx;
server ip2:xxxx;
}
both hash $http_x_forwarded_for; and hash $cookie_jsessionid;
have not achieved the load effect. How do I configure them?

Jun.09,2021

if the backend is Spring, consider using redis to save the session, so that the session can be saved across nodes.
by the way, why did you change from ip_hash to rewrite?

Menu