Good day!
The essence of the problem is to make it so that what when two different calls, but with the same cookie, get to the same node
I have nginx config it works well
upstream events {
hash $cookie_WSToken consistent;
# clients-events-node2
server 192.168.4.171:5212;
# clients-events-node1
server 192.168.4.171:5211;
}
location / {
access_log /var/log/nginx/events.log detailed2;
proxy_redirect http:// https://;
proxy_set_header Host $http_host;
proxy_hide_header X-Powered-By;
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_set_header X-Forwarded-Port $server_port;
proxy_pass http://events;
proxy_read_timeout 2700;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie;
proxy_set_header Cookie "";
how can I transfer this configuration to traefik?
specifically interested in how to do it: hash $cookie_WSToken consistent;
I tried like this:
- "traefik.enable=true"
- "traefik.docker.network=${APP_UID}-traefik-network"
- "traefik.http.routers.${APP_UID}-traefik.entrypoints=httponly"
- "traefik.http.routers.${APP_UID}-traefik.rule=Host${TRAEFIK_VIRT_HOST}"
- "traefik.http.routers.${APP_UID}-traefik-secure.entrypoints=${APP_UID}-https"
- "traefik.http.routers.${APP_UID}-traefik-secure.rule=Host${TRAEFIK_VIRT_HOST}"
- "traefik.http.routers.${APP_UID}-traefik-secure.tls=true"
- "traefik.http.routers.${APP_UID}-traefik-secure.service=${APP_UID}-traefik"
- "traefik.http.services.${APP_UID}-traefik"
- "traefik.http.services.${APP_UID}-traefik.loadbalancer.server.port=${APP_PORT}"
- "traefik.http.services.${APP_UID}-traefik.loadbalancer.sticky.cookie=true"
- "traefik.http.services.${APP_UID}-traefik.loadbalancer.sticky.cookie.secure=true"
- "traefik.http.services.${APP_UID}-traefik.loadbalancer.sticky.cookie.httpOnly=true"
- "traefik.http.services.${APP_UID}-traefik.loadbalancer.sticky.cookie.name=WSToken"
in the access log I see that this cookie is being replaced
"downstream_Set-Cookie": "WSToken=http://172.33.16.3:5000; Path=/; HttpOnly; Secure",
"origin_Set-Cookie": "WSToken=http://172.33.16.3:5000; Path=/; HttpOnly; Secure",
"request_Cookie": "WSToken=DEyMDEtODI0My00YTVhLWEyN2UtMTk4Y2U4ZTMwMTg5",