docs: Update header directive with regards to defer

This commit is contained in:
Matthew Holt 2020-02-04 11:10:30 -07:00
parent 0e0134f254
commit 3c6202c15d
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -6,6 +6,8 @@ title: header (Caddyfile directive)
Manipulates HTTP header fields on the response. It can set, add, and delete header values, or perform replacements using regular expressions.
By default, header operations are performed immediately unless any of the headers are being deleted, in which case the header operations are automatically deferred until the time they are being written to the client.
## Syntax
@ -14,6 +16,7 @@ header [<matcher>] [[+|-]<field> [<value>|<find>] [<replace>]] {
<field> <find> <replace>
[+]<field> <value>
-<field>
[defer]
}
```
@ -21,6 +24,7 @@ header [<matcher>] [[+|-]<field> [<value>|<find>] [<replace>]] {
- **&lt;value&gt;** is the header field value, if adding or setting a field.
- **&lt;find&gt;** is the substring or regular expression to search for.
- **&lt;replace&gt;** is the replacement value; required if performing a search-and-replace.
- **defer** will force the header operations to be deferred until the response is written out to the client. This is automatically enabled if any of the header fields are being deleted.
For multiple header manipulations, you can open a block and specify one manipulation per line in the same way.