Skip to content

Commit

Permalink
Merge pull request #111 from mjbnz/add-filter-option
Browse files Browse the repository at this point in the history
Add support for filter option for proxies.
  • Loading branch information
tersmitten authored Nov 30, 2021
2 parents d838814 + 417cee3 commit b760f8e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ 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]: Content filters to apply to this section
* `haproxy_listen.{n}.filter.{n}.name`: [required]: The filter to apply
* `haproxy_listen.{n}.filter.{n}.params`: [optional]: Parameters for the filter
* `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`)
Expand Down Expand Up @@ -227,6 +230,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`)
Expand Down Expand Up @@ -350,6 +355,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`)
Expand Down
3 changes: 3 additions & 0 deletions templates/etc/haproxy/backend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ backend {{ backend.name }}
{% if backend.cookie is defined %}
cookie {{ backend.cookie }}
{% endif %}
{% for filter in backend.filter | default([]) %}
filter {{ filter.name }}{{ filter.params is defined | ternary([''] + [filter.params], []) | join(' ') }}
{% endfor %}
{% for acl in backend.acl | default([]) %}
acl {{ acl.string }}
{% endfor %}
Expand Down
3 changes: 3 additions & 0 deletions templates/etc/haproxy/frontend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ frontend {{ frontend.name }}
{% for timeout in frontend.timeout | default([]) %}
timeout {{ timeout.type }} {{ timeout.timeout }}
{% endfor %}
{% for filter in frontend.filter | default([]) %}
filter {{ filter.name }}{{ filter.params is defined | ternary([''] + [filter.params], []) | join(' ') }}
{% endfor %}
{% for acl in frontend.acl | default([]) %}
acl {{ acl.string }}
{% endfor %}
Expand Down
3 changes: 3 additions & 0 deletions templates/etc/haproxy/listen.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ listen {{ listen.name }}
{% for timeout in listen.timeout | default([]) %}
timeout {{ timeout.type }} {{ timeout.timeout }}
{% endfor %}
{% for filter in listen.filter | default([]) %}
filter {{ filter.name }}{{ filter.params is defined | ternary([''] + [filter.params], []) | join(' ') }}
{% endfor %}
{% for acl in listen.acl | default([]) %}
acl {{ acl.string }}
{% endfor %}
Expand Down

0 comments on commit b760f8e

Please sign in to comment.