diff --git a/manifests/main/dirs.pp b/manifests/main/dirs.pp index eebe50e..2409bf6 100644 --- a/manifests/main/dirs.pp +++ b/manifests/main/dirs.pp @@ -38,5 +38,17 @@ class cd_haproxy::main::dirs ( seltype => etc_t, seluser => system_u, } + + # errors dir + file { $hy_errors_dir: + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + selrange => s0, + selrole => object_r, + seltype => etc_t, + seluser => system_u, + } } } diff --git a/manifests/main/files.pp b/manifests/main/files.pp index 8666012..996abfe 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -58,5 +58,20 @@ class cd_haproxy::main::files ( seltype => haproxy_var_run_t, seluser => system_u, } + + # error files + file { $hy_400_file: + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + selrange => s0, + selrole => object_r, + seltype => etc_t, + seluser => system_u, + content => template($hy_400_erb), + notify => Service[$hy_service], + } + } } diff --git a/manifests/params.pp b/manifests/params.pp index cdec5a5..7182fe4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -123,10 +123,13 @@ $hy_service = 'haproxy' # directories $hy_main_dir = '/etc/haproxy' +$hy_errors_dir = "${hy_main_dir}/errors" # files $hy_main_config = "${hy_main_dir}/haproxy.cfg" $hy_config_head_erb = 'cd_haproxy/haproxy_head.erb' +$hy_400_file = "${hy_errors_dir}/400.http" +$hy_400_erb = 'cd_haproxy/400_http.erb' # includes must be last diff --git a/templates/errors/400_http.erb b/templates/errors/400_http.erb new file mode 100644 index 0000000..e223e38 --- /dev/null +++ b/templates/errors/400_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 400 Bad request +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

400 Bad request

+Your browser sent an invalid request. + + diff --git a/templates/errors/403_http.erb b/templates/errors/403_http.erb new file mode 100644 index 0000000..a67e807 --- /dev/null +++ b/templates/errors/403_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 403 Forbidden +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

403 Forbidden

+Request forbidden by administrative rules. + + diff --git a/templates/errors/408_http.erb b/templates/errors/408_http.erb new file mode 100644 index 0000000..aafb130 --- /dev/null +++ b/templates/errors/408_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 408 Request Time-out +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

408 Request Time-out

+Your browser didn't send a complete request in time. + + diff --git a/templates/errors/500_http.erb b/templates/errors/500_http.erb new file mode 100644 index 0000000..bb121e8 --- /dev/null +++ b/templates/errors/500_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 500 Server Error +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

500 Server Error

+An internal server error occured. + + diff --git a/templates/errors/502_http.erb b/templates/errors/502_http.erb new file mode 100644 index 0000000..94b35d4 --- /dev/null +++ b/templates/errors/502_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 502 Bad Gateway +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

502 Bad Gateway

+The server returned an invalid or incomplete response. + + diff --git a/templates/errors/503_http.erb b/templates/errors/503_http.erb new file mode 100644 index 0000000..48fde58 --- /dev/null +++ b/templates/errors/503_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 503 Service Unavailable +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

503 Service Unavailable

+No server is available to handle this request. + + diff --git a/templates/errors/504_http.erb b/templates/errors/504_http.erb new file mode 100644 index 0000000..f925184 --- /dev/null +++ b/templates/errors/504_http.erb @@ -0,0 +1,9 @@ +HTTP/1.0 504 Gateway Time-out +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

504 Gateway Time-out

+The server didn't respond in time. + +