Skip to content

Commit

Permalink
Merge pull request #76 from floored1585/master
Browse files Browse the repository at this point in the history
adding rspirep option for backend
  • Loading branch information
tersmitten authored May 17, 2018
2 parents 4d1ca83 + a36c1d7 commit c82787c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ ansible.cfg
# Other files #
###############
!empty
*.sw[po]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_listen.{n}.rsprep`: [optional]: Response regexp edit definition
* `haproxy_listen.{n}.rsprep.{n}.string`: [required]: Regexp definition to be used on response
* `haproxy_listen.{n}.rsprep.{n}.cond`: [optional]: A condition to apply this rule
* `haproxy_listen.{n}.rspirep`: [optional]: Response regexp edit definition
* `haproxy_listen.{n}.rspirep.{n}.search`: [required]: The regular expression applied to HTTP headers and to the response line
* `haproxy_listen.{n}.rspirep.{n}.string`: [required]: The complete line to be added
* `haproxy_listen.{n}.rspirep.{n}.cond`: [optional]: Matching condition built from ACLs
* `haproxy_listen.{n}.errorfile`: [optional]: Errorfile declarations
* `haproxy_listen.{n}.errorfile.{n}.code`: [required]: The HTTP status code. Currently, HAProxy is capable of generating codes 200, 400, 403, 408, 500, 502, 503, and 504 (e.g. `400`)
* `haproxy_listen.{n}.errorfile.{n}.file`: [required]: A file containing the full HTTP response (e.g `/etc/haproxy/errors/400.http`)
Expand Down Expand Up @@ -185,6 +189,10 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_frontend.{n}.rsprep`: [optional]: Response regexp edit definition
* `haproxy_frontend.{n}.rsprep.{n}.string`: [required]: Regexp definition to be used on response
* `haproxy_frontend.{n}.rsprep.{n}.cond`: [optional]: A condition to apply this rule
* `haproxy_frontend.{n}.rspirep`: [optional]: Response regexp edit definition
* `haproxy_frontend.{n}.rspirep.{n}.search`: [required]: The regular expression applied to HTTP headers and to the response line
* `haproxy_frontend.{n}.rspirep.{n}.string`: [required]: The complete line to be added
* `haproxy_frontend.{n}.rspirep.{n}.cond`: [optional]: Matching condition built from ACLs
* `haproxy_frontend.{n}.compression`: [optional]: Compression declarations
* `haproxy_frontend.{n}.compression.{n}.name`: [required]: The compression name (e.g. `algo`, `type`, `offload`)
* `haproxy_frontend.{n}.compression.{n}.value`: [required]: The compression value, (e.g. if name = algo : one of this values `identity`, `gzip`, `deflate`, `raw-deflate` / if name = type : list of mime type separated by space for example `text/html text/plain text/css` / if name = `offload` value is empty)
Expand Down Expand Up @@ -213,6 +221,10 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_backend.{n}.timeout.timeout`: [required]: The timeout (in in milliseconds by default, but can be in any other unit if the number is suffixed by the unit) (e.g. `5000`, `50000`)
* `haproxy_backend.{n}.acl`: [optional]: Create an ACL check which can be later used in evaluations/conditionals
* `haproxy_backend.{n}.acl.{n}.string`: [required]: ACL entry to be used in conditional check later
* `haproxy_backend.{n}.rspirep`: [optional]: Response regexp edit definition
* `haproxy_backend.{n}.rspirep.{n}.search`: [required]: The regular expression applied to HTTP headers and to the response line
* `haproxy_backend.{n}.rspirep.{n}.string`: [required]: The complete line to be added
* `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}.http_request`: [optional]: Access control for Layer 7 requests
* `haproxy_backend.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`)
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 @@ -57,6 +57,11 @@ backend {{ backend.name }}
acl {{ acl.string }}
{% endfor %}

{% for rspirep in backend.rspirep | default([]) %}
rspirep {{ rspirep.search }} {{ rspirep.string }}{% if rspirep.cond is defined %} {{ rspirep.cond }}{% endif %}

{% endfor %}

{% if backend.stats is defined %}
{% if backend.stats.enable is defined and backend.stats.enable | bool == true %}
stats enable
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 @@ -76,6 +76,11 @@ frontend {{ frontend.name }}

{% endfor %}

{% for rspirep in frontend.rspirep | default([]) %}
rspirep {{ rspirep.search }} {{ rspirep.string }}{% if rspirep.cond is defined %} {{ rspirep.cond }}{% endif %}

{% endfor %}

{% for redirect in frontend.redirect | default([]) %}
redirect {{ redirect.string }}{% if redirect.cond is defined %} {{ redirect.cond }}{% endif %}

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 @@ -104,6 +104,11 @@ listen {{ listen.name }}

{% endfor %}

{% for rspirep in listen.rspirep | default([]) %}
rspirep {{ rspirep.search }} {{ rspirep.string }}{% if rspirep.cond is defined %} {{ rspirep.cond }}{% endif %}

{% endfor %}

{% for redirect in listen.redirect | default([]) %}
redirect {{ redirect.string }}{% if redirect.cond is defined %} {{ redirect.cond }}{% endif %}

Expand Down

0 comments on commit c82787c

Please sign in to comment.