diff --git a/README.md b/README.md index 205370b7..40445617 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_frontend.{n}.http_response.{n}.action`: [required]: The rules action (e.g. `del-header`) * `haproxy_frontend.{n}.http_response.{n}.param`: [optional]: The complete line to be added (e.g. `X-Varnish`) * `haproxy_frontend.{n}.http_response.{n}.cond`: [optional]: A matching condition built from ACLs -* `haproxy_frontend.{n}.use_backend`: [optional]: Switch to a specific backend if/unless a Layer 7 condition is matched. (e.g. '%[req.hdr(host),lower,map_dom(/etc/haproxy/haproxy_backend.map,bk_default)]') +* `haproxy_frontend.{n}.use_backend`: [optional]: Switch to a specific backend if/unless a Layer 7 condition is matched. (e.g. '%[req.hdr(host),lower,map_dom(/etc/haproxy/haproxy_backend.map,bk_default)]' or `['foo-backend if is_foo', 'bar-backend if is_bar']`) * `haproxy_frontend.{n}.default_backend`: [required]: The backend to use when no `"use_backend"` rule has been matched (e.g. `webservers`) * `haproxy_frontend.{n}.rspadd`: [optional]: Adds headers at the end of the HTTP response * `haproxy_frontend.{n}.rspadd.{n}.string`: [required]: The complete line to be added. Any space or known delimiter must be escaped using a backslash (`'\'`) (in version < 1.6) diff --git a/templates/etc/haproxy/frontend.cfg.j2 b/templates/etc/haproxy/frontend.cfg.j2 index fd31102d..72de8df0 100644 --- a/templates/etc/haproxy/frontend.cfg.j2 +++ b/templates/etc/haproxy/frontend.cfg.j2 @@ -65,7 +65,13 @@ frontend {{ frontend.name }} {% endfor %} {% if frontend.use_backend is defined %} +{% if frontend.use_backend is iterable and frontend.use_backend is not string %} +{% for use_backend in frontend.use_backend | default([]) %} + use_backend {{ use_backend }} +{% endfor %} +{% else %} use_backend {{ frontend.use_backend }} +{% endif %} {% endif %} default_backend {{ frontend.default_backend }}