Skip to content

Commit 3bbea2d

Browse files
committed
feat(config): support httperrors
Signed-off-by: Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
1 parent 2550aed commit 3bbea2d

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

haproxy/templates/haproxy.jinja

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ defaults
160160
errorfile {{ errorfile_name }} {{ errorfile }}
161161
{%- endfor %}
162162
{% endif %}
163+
164+
{%- for error_name, error_files in salt['pillar.get']('haproxy:httperrors', {}) | dictsort %}
165+
http-errors {{ error_name }}
166+
{%- for code, file in error_files | dictsort %}
167+
errorfile {{ code }} {{ file }}
168+
{%- endfor %}
169+
{%- endfor %}
170+
163171
{%- if salt['pillar.get']('haproxy:resolvers') %}
164172

165173

pillar.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ haproxy:
9090
503: /etc/haproxy/errors/503.http
9191
504: /etc/haproxy/errors/504.http
9292

93+
httperrors:
94+
corp:
95+
503: /etc/haproxy/errors/corp/503.http
96+
9397
resolvers:
9498
local_dns:
9599
options:
@@ -171,6 +175,9 @@ haproxy:
171175
- scheme https if !{ ssl_fc }
172176
reqadds:
173177
- "X-Forwarded-Proto:\\ http"
178+
httpresponses:
179+
- return:
180+
- status 503 errorfiles corp if { status 503 }
174181
default_backend: www-backend
175182

176183
# www-https:

0 commit comments

Comments
 (0)