2021-08-02 17:19:29 -04:00
|
|
|
# 73k.us custom rainbow error pages (40x/50x)
|
2021-08-02 17:05:36 -04:00
|
|
|
|
2021-08-02 17:19:29 -04:00
|
|
|
Based off [frontend-webpack-boilerplate](https://github.com/WeAreAthlon/frontend-webpack-boilerplate) with TailwindCSS added.
|
2021-08-02 17:05:36 -04:00
|
|
|
|
2021-11-25 14:31:32 -05:00
|
|
|
Builds html & css that can be used as custom error page templates with caddy.
|
2021-08-02 17:05:36 -04:00
|
|
|
|
2021-08-02 17:19:29 -04:00
|
|
|
## NOTE
|
2021-08-02 17:05:36 -04:00
|
|
|
|
2021-11-25 14:31:32 -05:00
|
|
|
After production build, optionally remove the empty, 0-byte app.js script tags from the built files, just to optimize things further.
|
2021-08-02 17:48:22 -04:00
|
|
|
|
2021-11-25 14:31:32 -05:00
|
|
|
### caddy example
|
2021-08-02 17:48:22 -04:00
|
|
|
|
2021-11-25 15:04:11 -05:00
|
|
|
With this snippet in the Caddyfile, for a site one can `import err` to handle errors for that site.
|
2021-08-02 17:48:22 -04:00
|
|
|
|
|
|
|
```
|
2021-11-25 15:04:11 -05:00
|
|
|
(err) {
|
2021-11-26 08:52:19 -05:00
|
|
|
@errpaths {
|
|
|
|
path /err_css/*
|
|
|
|
path /err_images/*
|
|
|
|
}
|
|
|
|
route @errpaths {
|
|
|
|
root * /www/err
|
|
|
|
file_server
|
|
|
|
}
|
2021-11-25 15:04:11 -05:00
|
|
|
respond /unknown_error_not_4xx_not_5xx "{http.error.status_code} {http.error.status_text}"
|
|
|
|
|
|
|
|
handle_errors {
|
|
|
|
@4xx expression `{http.error.status_code} >= 400 && {http.error.status_code} < 500`
|
|
|
|
@5xx expression `{http.error.status_code} >= 500 && {http.error.status_code} < 600`
|
|
|
|
|
|
|
|
root * /www/err
|
|
|
|
encode zstd gzip
|
|
|
|
file_server
|
|
|
|
|
|
|
|
rewrite @4xx /4xx.html
|
|
|
|
rewrite @5xx /5xx.html
|
|
|
|
rewrite * /unknown_error_not_4xx_not_5xx
|
|
|
|
templates
|
|
|
|
}
|
2021-08-02 17:48:22 -04:00
|
|
|
}
|
|
|
|
```
|