Skip to content

Commit

Permalink
Merge pull request #36 from Oefenweb/problem-with-multiple-backends
Browse files Browse the repository at this point in the history
Add support for multiple backends
  • Loading branch information
tersmitten authored Jan 23, 2017
2 parents c709deb + dfc785a commit 9f927d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions templates/etc/haproxy/frontend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit 9f927d2

Please sign in to comment.