hi, all:
我们在线上使用proxy_next_upstream来对后端失效进行容错, 配置是:
proxy_next_upstream error timeout http_502 invalid_header;
但是在部分情况下发现请求不能被重试到下一个后端, 表现是:
1. 在不能重试时, 通过 ngx.var.upstream_status 拿到的状态码为502
2. 在不能重试时, error log 打印出两种信息:
recv() failed (104: Connection reset by peer) while reading response header from upstream
或者是
upstream prematurely closed connection while reading response header from upstream
看起来是在读取 header 的时候遇到了错误, 但这时应该能命中invalid_header走重试才对, 但实际上请求到这里就结束了, 不再继续下一步
另一个问题, 关于 balancer 模块, 在后端明确返回502的情况下, balancer 模块的 get_last_failure 接口返回了 failed, 设计的原因是什么
@agentzh
thanks