Updated v2: Documentation (markdown)

Matt Holt 2019-08-21 11:45:41 -06:00
parent 50c3336c1d
commit 9e59dcdc3b

@ -29,6 +29,7 @@ Features which are available in Caddy Enterprise are indicated with   🏢
- [Config adapters](#config-adapters)
- [Caddyfile adapter](#caddyfile-adapter)
- [Matcher tokens](#matcher-tokens)
- [Shorthand placeholders](#shorthand-placeholders)
- [Caddyfile directives](#caddyfile-directives)
- [root](#root)
- [matcher](#matcher)
@ -41,6 +42,7 @@ Features which are available in Caddy Enterprise are indicated with   🏢
- [templates](#templates)
- [static_response](#static_response)
- [tls](#tls-directive)
- [try_files](#try_files)
- [Config structure](#config-structure)
- [admin](#admin)
- [storage](#storage)
@ -411,6 +413,22 @@ matcher name {
See the [Caddyfile directives](#caddyfile-directives) below for more details about matchers.
#### Shorthand placeholders
The Caddyfile is supposed to be easy to write, so it also provides shorter placeholder variable names for you to use. Instead of `{http.request.uri.path}` for example, you could just write `{path}`. Again, this loses some of the flexibility of the full JSON config because these shorthand variables are not properly namespaced. They are optional, however, so you are welcome to use the full name.
| Shorthand | Replaces |
|------------|------------------------------|
| {uri} | {http.request.uri} |
| {path} | {http.request.uri.path} |
| {host} | {http.request.host} |
| {hostport} | {http.request.hostport} |
| {method} | {http.request.method} |
| {scheme} | {http.request.scheme} |
| {file} | {http.request.uri.path.file} |
| {dir} | {http.request.uri.path.dir} |
| {query} | {http.request.uri.query} |
#### Caddyfile directives
@ -542,6 +560,14 @@ tls [off|<cert> <key>] {
}
```
##### try_files
Rewrites a request based on the existence of the listed files on disk. Because this is a fairly common rewrite, this directive simply combines a `rewrite` handler with a `file` matcher for convenience in writing.
```
try_files [<files...>]
```
# Config structure