diff --git a/src/docs/markdown/caddyfile/directives/header.md b/src/docs/markdown/caddyfile/directives/header.md index 1dc1eb5..1307998 100644 --- a/src/docs/markdown/caddyfile/directives/header.md +++ b/src/docs/markdown/caddyfile/directives/header.md @@ -12,16 +12,18 @@ By default, header operations are performed immediately unless any of the header ## Syntax ```caddy-d -header [] [[+|-] [|] []] { +header [] [[+|-|?] [|] []] { [+] - + ? [defer] } ``` - **<field>** is the name of the header field. By default, will overwrite any existing field of the same name. Prefix with `+` to add the field instead of replace, or prefix with `-` to remove the field. - **<value>** is the header field value, if adding or setting a field. +- **<default_value>** is the header field value that will be set only if the header does not already exist. - **<find>** is the substring or regular expression to search for. - **<replace>** 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. @@ -58,7 +60,7 @@ header { # disable clients from sniffing the media type X-Content-Type-Options nosniff - + # clickjacking protection X-Frame-Options DENY @@ -75,3 +77,10 @@ route { header /static/* Cache-Control max-age=31536000 } ``` + +Set a default cache expiration if upstream doesn't define one: + +```caddy-d +header ?Cache-Control "max-age=3600" +reverse_proxy upstream:443 +```