Add another handle_errors example

This commit is contained in:
Tobias Gruetzmacher 2022-10-02 15:22:06 +02:00
parent cec799bd2f
commit e17b29f308
No known key found for this signature in database

View file

@ -60,6 +60,20 @@ handle_errors {
}
```
If you want to provide custom error pages only for some error codes, you can check the existence of the custom error files beforehand with a [`file`](/docs/caddyfile/matchers#file) matcher:
```caddy-d
handle_errors {
@custom_err file /err-{http.error.status_code}.html /err.html
handle @custom_err {
rewrite @custom_err {http.matchers.file.relative}
file_server
}
respond "{http.error.status_code} {http.error.status_text}"
}
```
Reverse proxy to a professional server that is highly qualified for handling HTTP errors and improving your day 😸:
```caddy-d