mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 20:46:15 -04:00
docs: Some cleanup, some v2.4.0 additions (#139)
* docs: Some cleanup, some v2.4.0 additions - Add `abort` directive docs - Add a note in `handle` to cross-link to `handle_path` - Add another example in `handle_errors` that shows how an `expression` matcher can be used to pair with it - Add a cat emoji to handle_errors because 😸 - Add `file_server` to one of the `php_fastcgi` examples, it's rare that you'll ever use it without `file_server` so might as well include it there - Add a TOC to `reverse_proxy` cause it's such a long page. Maybe we'll add one to other pages as well, but TBD - Clarify the upstream address stuff a bit after some discussion in https://caddy.community/t/reverse-proxy-with-multiple-different-upstreams-with-paths/11512/12 and mention `rewrite` as the alternative - Use the `{re.*.*}` shortcut in the Caddyfile matcher docs, links to the placeholder mapping to let people trace where that comes from * docs: Revise the `handle` cross-linking, add another example * docs: Bump minimum Go version to 1.15 * docs: A bunch more additions since v2.3.0 I went through the whole list of commits here: https://github.com/caddyserver/caddy/compare/v2.3.0...ec3ac84 * docs: Review feedback * docs: Link to https://golang.org/doc/install, better instructions
This commit is contained in:
parent
0f4885e592
commit
3f3e0fb9f8
13 changed files with 119 additions and 20 deletions
|
@ -26,7 +26,7 @@ handle_errors {
|
|||
|
||||
Custom error pages based on the status code (i.e. a page called `404.html` for 404 errors):
|
||||
|
||||
```caddy
|
||||
```caddy-d
|
||||
handle_errors {
|
||||
rewrite * /{http.error.status_code}.html
|
||||
file_server
|
||||
|
@ -35,7 +35,7 @@ handle_errors {
|
|||
|
||||
A single error page that uses [`templates`](/docs/caddyfile/directives/templates) to write a custom error message:
|
||||
|
||||
```caddy
|
||||
```caddy-d
|
||||
handle_errors {
|
||||
rewrite * /error.html
|
||||
templates
|
||||
|
@ -43,9 +43,9 @@ handle_errors {
|
|||
}
|
||||
```
|
||||
|
||||
Reverse proxy to a professional server that is highly qualified for handling HTTP errors and improving your day:
|
||||
Reverse proxy to a professional server that is highly qualified for handling HTTP errors and improving your day 😸:
|
||||
|
||||
```caddy
|
||||
```caddy-d
|
||||
handle_errors {
|
||||
rewrite * /{http.error.status_code}
|
||||
reverse_proxy https://http.cat {
|
||||
|
@ -56,8 +56,19 @@ handle_errors {
|
|||
|
||||
Simply use [`respond`](/docs/caddyfile/directives/respond) to return the error code and name
|
||||
|
||||
```caddy
|
||||
```caddy-d
|
||||
handle_errors {
|
||||
respond "{http.error.status_code} {http.error.status_text}"
|
||||
}
|
||||
```
|
||||
|
||||
To handle specific error codes differently, use an [`expression`](/docs/caddyfile/matchers#expression) matcher:
|
||||
|
||||
```caddy-d
|
||||
handle_errors {
|
||||
@4xx expression `{http.error.status_code} >= 400 && {http.error.status_code} < 500`
|
||||
respond @4xx "It's a 4xx error!"
|
||||
|
||||
respond "It's not a 4xx error."
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue