nginx_upstream_check_module
nginx_upstream_check_module copied to clipboard
后端接口正常,但是健康检查返回400!
在主机上使用curl去访问后端接口是可以正常返回数据的,但是但是健康检查直接返回fail,经过测试返回的响应码应该是4xx。 upstream配置如下:
upstream testapi {
server ip:port;
check interval=5000 rise=3 fall=5 timeout=1000 type=http;
check_http_send "GET /v1/chain/get_info HTTP/1.1\r\n\r\n";
check_http_expect_alive http_2xx;
}
nginx version: nginx/1.17.1
patch:check_1.16.1+.patch
不知道是不是版本兼容的问题?
check_http_send "GET /v1/chain/get_info HTTP/1.0\r\n\r\n";
你用1.17版本不行的,patch中的内容是针对1.16.1版本的,所以会出错,要下载对应的版本匹配
http1.1 请求头要配上Host,否则返回400 例如 check_http_send "GET /v1/chain/get_info HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n";