diff --git a/README.md b/README.md index 916d8c26..44114e93 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_listen.{n}.option`: [optional]: Options to set (e.g. `[dontlog-normal]`) * `haproxy_listen.{n}.no_option`: [optional]: Options to set (e.g. `[dontlog-normal]`) * `haproxy_listen.{n}.tcp_check`: [optional]: Perform health checks using tcp-check send/expect sequences (e.g. `['expect string +OK\ POP3\ ready']`) +* `haproxy_listen.{n}.http_check`: [optional]: Make HTTP health checks consider response contents or specific status codes (e.g. `expect status 403`) * `haproxy_listen.{n}.timeout`: [optional]: Timeout declarations * `haproxy_listen.{n}.timeout.type`: [required]: The type (e.g. `connect`, `client`, `server`) * `haproxy_listen.{n}.timeout.timeout`: [required]: The timeout (in in milliseconds by default, but can be in any other unit if the number is suffixed by the unit) (e.g. `5000`, `50000`) @@ -162,6 +163,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_backend.{n}.balance`: [required]: The load balancing algorithm to be used (e.g. `roundrobin`) * `haproxy_backend.{n}.source`: [optional]: Set the source address or interface for connections from the proxy * `haproxy_backend.{n}.option`: [optional]: Options to set (e.g. `[forwardfor]`) +* `haproxy_backend.{n}.http_check`: [optional]: Make HTTP health checks consider response contents or specific status codes (e.g. `expect status 403`) * `haproxy_backend.{n}.no_option`: [optional]: Options to unset (e.g. `[forceclose]`) * `haproxy_backend.{n}.tcp_check`: [optional]: Perform health checks using tcp-check send/expect sequences (e.g. `['expect string +OK\ POP3\ ready']`) * `haproxy_backend.{n}.timeout`: [optional]: Timeout declarations diff --git a/templates/etc/haproxy/backend.cfg.j2 b/templates/etc/haproxy/backend.cfg.j2 index 86abb8a0..79c90d56 100644 --- a/templates/etc/haproxy/backend.cfg.j2 +++ b/templates/etc/haproxy/backend.cfg.j2 @@ -20,6 +20,9 @@ backend {{ backend.name }} option {{ option }} {% endfor %} +{% if backend.http_check is defined %} + http-check {{ backend.http_check }} +{% endif %} {% for option in backend.no_option | default([]) %} no option {{ option }} {% endfor %} diff --git a/templates/etc/haproxy/listen.cfg.j2 b/templates/etc/haproxy/listen.cfg.j2 index 88aa6fe3..9b3b6cfc 100644 --- a/templates/etc/haproxy/listen.cfg.j2 +++ b/templates/etc/haproxy/listen.cfg.j2 @@ -23,6 +23,10 @@ listen {{ listen.name }} maxconn {{ listen.maxconn }} {% endif %} +{% if listen.http_check is defined %} + http-check {{ listen.http_check }} +{% endif %} + {% if listen.source is defined %} source {{ listen.source }} {% endif %}