Improve error page

This commit is contained in:
BBaoVanC 2021-08-21 17:18:23 -05:00
parent acfa066ed1
commit ede09f7e45
5 changed files with 28 additions and 2 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
email
errors/img/

View File

@ -17,8 +17,9 @@
handle_errors {
#respond "{http.error.status_code} {http.error.status_text}"
rewrite * /{http.error.status_code}.jpg
root * /var/www/errors
templates
rewrite * /index.html
root * /etc/caddy/errors
file_server
}
}

7
conf.d/errors.boba.best Normal file
View File

@ -0,0 +1,7 @@
# vim: ft=caddyfile
errors.boba.best {
root * /etc/caddy/errors/img
file_server
import basicerrors
}

5
errors/dl.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
mkdir -p img/
cd img/
curl https://http.cat | grep -oE '[0-9]{3}\.jpg' | sort | uniq | parallel $@ 'wget -q https://http.cat/{} && echo "DL {}"'

11
errors/index.html Normal file
View File

@ -0,0 +1,11 @@
<html>
<head>
<title>{{placeholder "http.error.status_code"}} {{placeholder "http.error.status_text"}}</title>
</head>
<body bgcolor="black" text="white">
<center>
<h1>{{placeholder "http.error.status_code"}} {{placeholder "http.error.status_text"}}</h1>
<img src='https://errors.boba.best/{{placeholder "http.error.status_code"}}.jpg' alt="cat" />
</center>
</body>
</html>