Skip to content

Commit 4d35b46

Browse files
committed
Create and populate the errors directory
This is taken straight from devops-coop/ansible-haproxy#104. Credits to Reza Jelveh AKA @fishman.
1 parent 924dac8 commit 4d35b46

File tree

8 files changed

+105
-0
lines changed

8 files changed

+105
-0
lines changed

files/400.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 400 Bad request
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>400 Bad request</h1>
7+
Your browser sent an invalid request.
8+
</body></html>
9+

files/403.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 403 Forbidden
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>403 Forbidden</h1>
7+
Request forbidden by administrative rules.
8+
</body></html>
9+

files/408.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 408 Request Time-out
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>408 Request Time-out</h1>
7+
Your browser didn't send a complete request in time.
8+
</body></html>
9+

files/500.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 500 Server Error
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>500 Server Error</h1>
7+
An internal server error occured.
8+
</body></html>
9+

files/502.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 502 Bad Gateway
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>502 Bad Gateway</h1>
7+
The server returned an invalid or incomplete response.
8+
</body></html>
9+

files/503.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 503 Service Unavailable
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>503 Service Unavailable</h1>
7+
No server is available to handle this request.
8+
</body></html>
9+

files/504.http

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
HTTP/1.0 504 Gateway Time-out
2+
Cache-Control: no-cache
3+
Connection: close
4+
Content-Type: text/html
5+
6+
<html><body><h1>504 Gateway Time-out</h1>
7+
The server didn't respond in time.
8+
</body></html>
9+

tasks/configure.yml

+42
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,48 @@
138138
with_items: "{{ haproxy_userlists }}"
139139
when: haproxy_userlists is defined
140140

141+
## CREATE ERROR PAGES
142+
143+
- name: Add error directory
144+
file:
145+
path: "{{ haproxy_config_dir }}/errors"
146+
state: directory
147+
148+
- name: Ensure http 400 error file is present
149+
copy:
150+
src: 400.http
151+
dest: "{{ haproxy_config_dir }}/errors/400.http"
152+
153+
- name: Ensure http 403 error file is present
154+
copy:
155+
src: 403.http
156+
dest: "{{ haproxy_config_dir }}/errors/403.http"
157+
158+
- name: Ensure http 408 error file is present
159+
copy:
160+
src: 408.http
161+
dest: "{{ haproxy_config_dir }}/errors/408.http"
162+
163+
- name: Ensure http 500 error file is present
164+
copy:
165+
src: 500.http
166+
dest: "{{ haproxy_config_dir }}/errors/500.http"
167+
168+
- name: Ensure http 502 error file is present
169+
copy:
170+
src: 502.http
171+
dest: "{{ haproxy_config_dir }}/errors/502.http"
172+
173+
- name: Ensure http 503 error file is present
174+
copy:
175+
src: 503.http
176+
dest: "{{ haproxy_config_dir }}/errors/503.http"
177+
178+
- name: Ensure http 504 error file is present
179+
copy:
180+
src: 504.http
181+
dest: "{{ haproxy_config_dir }}/errors/504.http"
182+
141183
## ASSEMBLE CONFIG - GLOBAL & DEFAULT
142184

143185
- name: 'Delete the compiled folder'

0 commit comments

Comments
 (0)