diff --git a/README.md b/README.md index 4ee7ae31..aedaddc1 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_listen.{n}.capture.type`: [required]: What to capture (`cookie`, `request header`, `response header`) * `haproxy_listen.{n}.capture.name`: [required]: Name of the header or cookie to capture * `haproxy_listen.{n}.capture.length`: [required]: Maximum number of characters to capture and report in the logs +* `haproxy_listen.{n}.filter`: [optional]: Dictionary of content filters to apply to this section +* `haproxy_listen.{n}.filter.{name}`: [required]: One or more filter `name: param` entries to apply * `haproxy_listen.{n}.http_request`: [optional]: Access control for Layer 7 requests * `haproxy_listen.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`) * `haproxy_listen.{n}.http_request.{n}.param`: [optional]: The complete line to be added (e.g. `X-Forwarded-Proto https`) @@ -222,6 +224,8 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_frontend.{n}.capture.type`: [required]: What to capture (`cookie`, `request header`, `response header`) * `haproxy_frontend.{n}.capture.name`: [required]: Name of the header or cookie to capture * `haproxy_frontend.{n}.capture.length`: [required]: Maximum number of characters to capture and report in the logs +* `haproxy_frontend.{n}.filter`: [optional]: Dictionary of content filters to apply to this section +* `haproxy_frontend.{n}.filter.{name}`: [required]: One or more filter `name: param` entries to apply * `haproxy_frontend.{n}.http_request`: [optional]: Access control for Layer 7 requests * `haproxy_frontend.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`) * `haproxy_frontend.{n}.http_request.{n}.param`: [optional]: The complete line to be added (e.g. `X-Forwarded-Proto https`) @@ -344,6 +348,8 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_backend.{n}.rspirep.{n}.string`: [required]: The complete line to be added. Any space or known delimiter must be escaped using a backslash (`'\'`) (in version < 1.6) * `haproxy_backend.{n}.rspirep.{n}.cond`: [optional]: Matching condition built from ACLs * `haproxy_backend.{n}.cookie`: [optional]: Enable cookie-based persistence in a backend (e.g. `JSESSIONID prefix nocache`) +* `haproxy_backend.{n}.filter`: [optional]: Dictionary of content filters to apply to this section +* `haproxy_backend.{n}.filter.{name}`: [required]: One or more filter `name: param` entries to apply * `haproxy_backend.{n}.http_request`: [optional]: Access control for Layer 7 requests * `haproxy_backend.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`) * `haproxy_backend.{n}.http_request.{n}.param`: [optional]: The complete line to be added (e.g. `X-Forwarded-Proto https`) diff --git a/templates/etc/haproxy/backend.cfg.j2 b/templates/etc/haproxy/backend.cfg.j2 index 855b2f09..1b91cb60 100644 --- a/templates/etc/haproxy/backend.cfg.j2 +++ b/templates/etc/haproxy/backend.cfg.j2 @@ -23,6 +23,11 @@ backend {{ backend.name }} {% if backend.cookie is defined %} cookie {{ backend.cookie }} {% endif %} +{% if backend.filter is defined %} +{% for name, value in backend.filter.items() %} + filter {{ name }} {{ value }} +{% endfor %} +{% endif %} {% for acl in backend.acl | default([]) %} acl {{ acl.string }} {% endfor %} diff --git a/templates/etc/haproxy/frontend.cfg.j2 b/templates/etc/haproxy/frontend.cfg.j2 index 465c89f7..15afc69c 100644 --- a/templates/etc/haproxy/frontend.cfg.j2 +++ b/templates/etc/haproxy/frontend.cfg.j2 @@ -32,6 +32,11 @@ frontend {{ frontend.name }} {% for timeout in frontend.timeout | default([]) %} timeout {{ timeout.type }} {{ timeout.timeout }} {% endfor %} +{% if frontend.filter is defined %} +{% for name, value in frontend.filter.items() %} + filter {{ name }} {{ value }} +{% endfor %} +{% endif %} {% for acl in frontend.acl | default([]) %} acl {{ acl.string }} {% endfor %} diff --git a/templates/etc/haproxy/listen.cfg.j2 b/templates/etc/haproxy/listen.cfg.j2 index b46bfe92..8cfa9332 100644 --- a/templates/etc/haproxy/listen.cfg.j2 +++ b/templates/etc/haproxy/listen.cfg.j2 @@ -42,6 +42,11 @@ listen {{ listen.name }} {% for timeout in listen.timeout | default([]) %} timeout {{ timeout.type }} {{ timeout.timeout }} {% endfor %} +{% if listen.filter is defined %} +{% for name, value in listen.filter.items() %} + filter {{ name }} {{ value }} +{% endfor %} +{% endif %} {% for acl in listen.acl | default([]) %} acl {{ acl.string }} {% endfor %}