gpt4 book ai didi

iis - Haproxy 粘性 session

转载 作者:行者123 更新时间:2023-12-05 00:48:33 29 4
gpt4 key购买 nike

我正在尝试使用 Haproxy 1.6.3 2015/12/25 和粘性 session 。我按照haproxy manual做的一切,但是,不幸的是,检查客户端浏览器我发现没有添加 cookie(平衡器必须在第一次请求后的响应中返回 cookie,但它什么也没返回,并且什么也没发生(没有 cookie))。其他一切都完美无缺,但 cookie 却不行。我附上了我的 haproxy.cfg:

global
log /dev/haproxy/log local0
log /dev/haproxy/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon

defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms

stats enable
stats auth user:pass
stats uri /haproxy_stats

option httpchk HEAD / HTTP/1.0
option redispatch

balance roundrobin

frontend frontend_http
bind *:80
option forwardfor
default_backend backend_http

backend backend_http
option prefer-last-server
cookie mycookies insert indirect nocache
server server1 196.168.0.125:80 check cookie s1
server server2 196.168.0.126:80 check cookie s2

我的服务器(server1、server2)也部署在 IIS 上,而平衡器部署在 Ubuntu 16.04 LTS

最佳答案

更改后端配置:

backend backend_http
option prefer-last-server
cookie mycookies insert indirect nocache
server server1 196.168.0.125:80 check cookie server1
server server2 196.168.0.126:80 check cookie server2

backend backend_http
option prefer-last-server
cookie mycookies insert indirect nocache
server s1 196.168.0.125:80 check cookie s1
server s2 196.168.0.126:80 check cookie s2

关于iis - Haproxy 粘性 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50149747/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com