> monitor-uri looks like it would only work as a path match.
>
> I need to match a Host header.
>
> eg.
> ping.example.com (always return 200 when haproxy is running)
> vs
> www.example.com (proxy to backend pool)
>
>
Hi,
you can use an ACL to forward ping.example.com to a backend with no server.
HAProxy should generate a 503 error, since no servers are available,
but you can force it to use a specific 503 error file with the
errorfile directive.
in the content of the error file, you can specify the HTTP status
code, so just specify 200.
use_backend bk_ping if { hdr_beg(Host) ping. }
backend bk_ping
errorfile 503 /path/to/503.txt
content of 503.txt file:
=======================
HTTP/1.0 200 OK
Cache-Control: no-cache
Connection: close
Content-Type: text/html
Content-Length: 4
pong
=======================
If you need a longer file, use the script below to know the content length:
https://github.com/exceliance/haproxy/blob/master/scripts/errorfile_content_length
Baptiste