Open zhubingbi opened 4 years ago
location中没有写 session_sticky_hide_cookie 会导致list 接口获取不到upstream信息?
我的配置如下: location ^~ /bankaccountexterws/ {
add_header X-From $short_address$1; access_log logs/market.access.log main; error_log logs/market.error.log; proxy_pass http://bankaccountexterws_backend/bankaccountexterws/; }
upstream bankaccountexterws_backend { server 172.22.145.96:9981 weight=1; server 172.22.154.41:9981 weight=1; check interval=3000 rise=2 fall=5 timeout=1000 type=http; check_keepalive_requests 100; check_http_send "HEAD /test/api/index HTTP/1.1\r\nConnection: keep-alive\r\nHost: baidu.com\r\n\r\n"; check_http_expect_alive http_2xx http_3xx;
}
在location 配置中解开 session_sticky_hide_cookie 的注释,就能获取到upstream,但是注释掉了的话就获取不到upstream了。
这让我觉得很疑惑...
解决方案是用作者文档中的set 变量的方式。 但是很奇怪的是,为什么我在不设置变量但是有 session_sticky_hide_cookie 配置的时候也能获取到upstream信息呢?
location中没有写 session_sticky_hide_cookie 会导致list 接口获取不到upstream信息?
我的配置如下: location ^~ /bankaccountexterws/ {
session_sticky_hide_cookie upstream=bankaccountexterws_backend_backend
upstream bankaccountexterws_backend { server 172.22.145.96:9981 weight=1; server 172.22.154.41:9981 weight=1; check interval=3000 rise=2 fall=5 timeout=1000 type=http; check_keepalive_requests 100; check_http_send "HEAD /test/api/index HTTP/1.1\r\nConnection: keep-alive\r\nHost: baidu.com\r\n\r\n"; check_http_expect_alive http_2xx http_3xx;
session_sticky cookie=ngx-bankaccountexterws path=/bankaccountexterws mode=insert fallback=on option=indirect;
}
在location 配置中解开 session_sticky_hide_cookie 的注释,就能获取到upstream,但是注释掉了的话就获取不到upstream了。
这让我觉得很疑惑...