Skip to content

Commit

Permalink
Add support for filter option for proxies.
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beattie <[email protected]>
  • Loading branch information
mjbnz committed Jun 30, 2020
1 parent 1eb95fa commit a62d58f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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`)
Expand Down Expand Up @@ -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`)
Expand Down
5 changes: 5 additions & 0 deletions templates/etc/haproxy/backend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
5 changes: 5 additions & 0 deletions templates/etc/haproxy/frontend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
5 changes: 5 additions & 0 deletions templates/etc/haproxy/listen.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down

0 comments on commit a62d58f

Please sign in to comment.