Skip to content

Commit

Permalink
Merge pull request #67 from yumapos/custom_errorfiles
Browse files Browse the repository at this point in the history
Custom errorfiles
  • Loading branch information
tersmitten authored Oct 20, 2017
2 parents 5d45800 + abb9a0f commit b9fd4df
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ 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}.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`)

* `haproxy_frontend`: [default: `[]`]: Front-end declarations
* `haproxy_frontend.{n}.name`: [required]: The name of the section (e.g. `https`)
Expand Down Expand Up @@ -176,6 +179,9 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `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)
* `haproxy_frontend.{n}.errorfile`: [optional]: Errorfile declarations
* `haproxy_frontend.{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_frontend.{n}.errorfile.{n}.file`: [required]: A file containing the full HTTP response (e.g `/etc/haproxy/errors/400.http`)

* `haproxy_backend`: [default: `[]`]: Back-end declarations
* `haproxy_backend.{n}.name`: [required]: The name of the section (e.g. `webservers`)
Expand Down Expand Up @@ -220,6 +226,9 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_backend.{n}.server.{n}.name`: [required]: The internal name assigned to this server
* `haproxy_backend.{n}.server.{n}.listen`: [required]: Defines a listening address and/or ports
* `haproxy_backend.{n}.server.{n}.param`: [optional]: A list of parameters for this server
* `haproxy_backend.{n}.errorfile`: [optional]: Errorfile declarations
* `haproxy_backend.{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_backend.{n}.errorfile.{n}.file`: [required]: A file containing the full HTTP response (e.g `/etc/haproxy/errors/400.http`)

* `haproxy_userlists`: [default: `[]`]: Userlist declarations
* `haproxy_userlists.{n}.name`: [required]: The name of the userlist
Expand Down
6 changes: 6 additions & 0 deletions templates/etc/haproxy/backend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,10 @@ backend {{ backend.name }}

{% endfor %}

{% if backend.errorfile is defined %}
{% for errorfile in backend.errorfile %}
errorfile {{ errorfile.code }} {{ errorfile.file }}
{% endfor %}
{% endif %}

{% endfor %}
6 changes: 6 additions & 0 deletions templates/etc/haproxy/frontend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,10 @@ frontend {{ frontend.name }}

default_backend {{ frontend.default_backend }}

{% if frontend.errorfile is defined %}
{% for errorfile in frontend.errorfile %}
errorfile {{ errorfile.code }} {{ errorfile.file }}
{% endfor %}
{% endif %}

{% endfor %}
6 changes: 6 additions & 0 deletions templates/etc/haproxy/listen.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,10 @@ listen {{ listen.name }}

{% endfor %}

{% if listen.errorfile is defined %}
{% for errorfile in listen.errorfile %}
errorfile {{ errorfile.code }} {{ errorfile.file }}
{% endfor %}
{% endif %}

{% endfor %}

0 comments on commit b9fd4df

Please sign in to comment.