mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 20:46:15 -04:00
Revert "caddyfile: snippet block input documentation (#400)"
This reverts commit 41470c4e02
.
This commit is contained in:
parent
3381c0a0c9
commit
cf78bf0716
2 changed files with 1 additions and 74 deletions
|
@ -413,29 +413,6 @@ b.example.com {
|
|||
}
|
||||
```
|
||||
|
||||
⚠️ <i>Experimental</i> <span style='white-space: pre;'> | </span> <span>v2.9.x+</span>
|
||||
|
||||
You can also pass an optional block to an imported snippet, and use them as follows.
|
||||
|
||||
```caddy
|
||||
(snippet) {
|
||||
{block}
|
||||
respond "OK"
|
||||
}
|
||||
|
||||
a.example.com {
|
||||
import snippet {
|
||||
header +foo bar
|
||||
}
|
||||
}
|
||||
|
||||
b.example.com {
|
||||
import snippet {
|
||||
header +bar foo
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**[Read the `import` directive page](/docs/caddyfile/directives/import) to learn more.**
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ This directive is a special case: it is evaluated before the structure is parsed
|
|||
## Syntax
|
||||
|
||||
```caddy-d
|
||||
import <pattern> [<args...>] [{block}]
|
||||
import <pattern> [<args...>]
|
||||
```
|
||||
|
||||
- **<pattern>** is the filename, glob pattern, or name of [snippet](/docs/caddyfile/concepts#snippets) to include. Its contents will replace this line as if that file's contents appeared here to begin with.
|
||||
|
@ -34,11 +34,6 @@ import <pattern> [<args...>] [{block}]
|
|||
|
||||
Note that prior to v2.7.0, the syntax was `{args.N}` but this form was deprecated in favor of the more flexible syntax above.
|
||||
|
||||
⚠️ <i>Experimental</i> <span style='white-space: pre;'> | </span> <span>v2.9.x+</span>
|
||||
- **{block...}** is an optional block to pass to the imported tokens. This placeholder is a special case, and is evaluated recursively at Caddyfile-parse-time, not at runtime. They can be used in two forms:
|
||||
- `{block}` where the content of provided block will be substituted for the placeholder.
|
||||
- `{block.key}` where `key` is the first token of a parameter within the provided block
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -90,48 +85,3 @@ example.com {
|
|||
import proxy-rewrite /api 10.0.0.1 10.0.0.2 10.0.0.3
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
⚠️ <i>Experimental</i> <span style='white-space: pre;'> | </span> <span>v2.9.x+</span>
|
||||
|
||||
Import a snippet which provides extendable options for a reverse proxy
|
||||
|
||||
```caddy
|
||||
(extendable-proxy) {
|
||||
reverse_proxy {
|
||||
to {block.proxy_target}
|
||||
{block.proxy_options}
|
||||
}
|
||||
}
|
||||
|
||||
example.com {
|
||||
import extendable-proxy {
|
||||
proxy_target 10.0.0.1
|
||||
proxy_options {
|
||||
transport http {
|
||||
tls
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Import a snippet that serves any set of directives, but with a pre-loaded middleware.
|
||||
|
||||
```caddy
|
||||
(instrumented-route) {
|
||||
header {
|
||||
Alt-Svc `h3="0.0.0.0:443"; ma=2592000`
|
||||
}
|
||||
tracing {
|
||||
span args[0]
|
||||
}
|
||||
{block}
|
||||
}
|
||||
|
||||
example.com {
|
||||
import instrumented-route example-com {
|
||||
respond "OK"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue