Nginx - Failed to save session

0

I'm configuring Nginx to perform load balancing on an environment, write the session and the ip of the server to which the request was received. I followed some tutorials on the internet and finished the configuration, but when I try to redirect them without recording the session, it works, but the two services together do not work, that is, when I use hash , Nginx does not distribute the load for tomcats, maintaining the connection to a single server.

/nginx.config:

upstream gravame {

    hash $upstream_grp;     

    server servidor_ip;
    server servidor_ip;
    server servidor_ip;
    server servidor_ip;
    server servidor_ip;
}

split_clients "client${remote_addr}${http_user_agent}${date_gmt}" $upstream_var {
    20.0%   "servidor_ip";
    20.0%   "servidor_ip";
    20.0%   "servidor_ip";
    20.0%   "servidor_ip";
    20.0%   "servidor_ip";

}           

map $cookie_route $upstream_grp {
    default         $upstream_var;
    "servidor_ip"  "servidor_ip";
    "servidor_ip"  "servidor_ip";
    "servidor_ip"  "servidor_ip";
    "servidor_ip"  "servidor_ip";
    "servidor_ip"  "servidor_ip";
}
server {
    listen       80;
    server_name  localhost;

    location / {
        add_header Set-Cookie 'route=$upstream_grp;Path=/;HttpOnly';
        proxy_pass http://gravame/;
    }
    
asked by anonymous 23.03.2018 / 15:50

0 answers