From 7ee3d6caf2736bce0c1c681f09ba0ffed0e20b80 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 7 Jun 2020 16:16:32 +0200 Subject: [PATCH] Add error pages --- .gitmodules | 3 +++ errpage | 1 + tasks/main.yml | 10 ++++++++++ templates/haproxy.conf.j2 | 8 ++++++++ 4 files changed, 22 insertions(+) create mode 100644 .gitmodules create mode 160000 errpage diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..eec3cf2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "errpage"] + path = errpage + url = https://git.redxen.eu/RedXen/haproxy-errpages diff --git a/errpage b/errpage new file mode 160000 index 0000000..0f655ca --- /dev/null +++ b/errpage @@ -0,0 +1 @@ +Subproject commit 0f655ca54fbe1519081cb3f45298d6e2a24938be diff --git a/tasks/main.yml b/tasks/main.yml index ed09ae2..5eac516 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,3 +9,13 @@ tags: - haproxy - config +- name: Copy error page overrides + copy: + src: '{{ role_path }}/errpage/' + dest: '/etc/haproxy/errors/' + follow: yes + notify: Run service actions + tags: + - haproxy + - config + - errorpages diff --git a/templates/haproxy.conf.j2 b/templates/haproxy.conf.j2 index 19dbf27..c32791e 100644 --- a/templates/haproxy.conf.j2 +++ b/templates/haproxy.conf.j2 @@ -21,6 +21,14 @@ defaults timeout http-keep-alive 240s default-server resolvers local init-addr libc,none resolve-opts prevent-dup-ip check + errorfile 400 /etc/haproxy/errors/400.http + errorfile 403 /etc/haproxy/errors/403.http + errorfile 408 /etc/haproxy/errors/408.http + errorfile 500 /etc/haproxy/errors/500.http + errorfile 502 /etc/haproxy/errors/502.http + errorfile 503 /etc/haproxy/errors/503.http + errorfile 504 /etc/haproxy/errors/504.http + resolvers local nameserver unbound 127.0.0.1:53 resolve_retries 2