haproxy return 空响应
haproxy return empty response
我希望仅根据 haproxy 是否 运行 对 haproxy 实例进行健康检查失败。换句话说,我不希望将健康检查代理到后端服务器。
我看到 returning a static file 有办法做到这一点。这对我有用,但我想知道:有没有一种方法可以 return 一个只有状态代码的空响应,而不必 return 一个文件并处理错误的 503?链接的解决方案似乎很老套,我担心在某些更高版本中将不允许该行为。
monitor-uri <uri>
Intercept a URI used by external components' monitor requests
May be used in sections :
When an HTTP request referencing will be received on a frontend,
HAProxy will not forward it nor log it, but instead will return either
"HTTP/1.0 200 OK" or "HTTP/1.0 503 Service unavailable", depending on
failure conditions defined with "monitor fail". This is normally
enough for any front-end HTTP probe to detect that the service is UP
and running without forwarding the request to a backend server. Note
that the HTTP method, the version and all headers are ignored, but the
request must at least be valid at the HTTP level. This keyword may
only be used with an HTTP-mode frontend.
Example :
# Use /haproxy_test to report haproxy's status
frontend www
mode http
monitor-uri /haproxy_test
我希望仅根据 haproxy 是否 运行 对 haproxy 实例进行健康检查失败。换句话说,我不希望将健康检查代理到后端服务器。
我看到 returning a static file 有办法做到这一点。这对我有用,但我想知道:有没有一种方法可以 return 一个只有状态代码的空响应,而不必 return 一个文件并处理错误的 503?链接的解决方案似乎很老套,我担心在某些更高版本中将不允许该行为。
monitor-uri <uri> Intercept a URI used by external components' monitor requests May be used in sections :
When an HTTP request referencing will be received on a frontend, HAProxy will not forward it nor log it, but instead will return either "HTTP/1.0 200 OK" or "HTTP/1.0 503 Service unavailable", depending on failure conditions defined with "monitor fail". This is normally enough for any front-end HTTP probe to detect that the service is UP and running without forwarding the request to a backend server. Note that the HTTP method, the version and all headers are ignored, but the request must at least be valid at the HTTP level. This keyword may only be used with an HTTP-mode frontend.
Example :
# Use /haproxy_test to report haproxy's status frontend www mode http monitor-uri /haproxy_test