Header replacement defer

This commit is contained in:
Francis Lavoie 2023-07-15 20:22:13 -04:00
parent 43ac227b6c
commit d17e10406e
No known key found for this signature in database
GPG key ID: 0F66EE1687682239

View file

@ -13,9 +13,6 @@ By default, header operations are performed immediately unless any of the header
```caddy-d
header [<matcher>] [[+|-|?|>]<field> [<value>|<find>] [<replace>]] {
# Replace
<field> <find> <replace>
# Add
+<field> <value>
@ -28,6 +25,12 @@ header [<matcher>] [[+|-|?|>]<field> [<value>|<find>] [<replace>]] {
# Delete
-<field>
# Replace
<field> <find> <replace>
# Replace with defer
><field> <find> <replace>
# Default
?<field> <value>
@ -121,3 +124,9 @@ To override the cache expiration that a proxy upstream had set for paths startin
header /no-cache* >Cache-Control nocache
reverse_proxy upstream:443
```
To perform a deferred update of a `Set-Cookie` header to add `SameSite=None`; a regexp capture is used to grab the existing value, and `$1` re-inserts it at the start with the additional option appended:
```caddy-d
header >Set-Cookie (.*) "$1; SameSite=None;"
```