-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: document more of header
directive behavior
#442
base: master
Are you sure you want to change the base?
Conversation
header <field> [<value>] | ||
header <field> <value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be reading this wrong, but this seemed to suggest that the header value is optional. This change to emphasize that both the header name and the value are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's technically optional because you can do -Field
to delete a header, in which case no value is passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about the header directive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah sorry. I didn't click through to the files changed so I didn't notice it was the response matcher in encode
. That said, !
as a prefix is allowed, meaning "this header doesn't exist in the response" and in that case you omit the value. See https://caddyserver.com/docs/caddyfile/response-matchers#header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, didn't know about the !
syntax. I'll revert.
@@ -37,28 +37,43 @@ header [<matcher>] [[+|-|?|>]<field> [<value>|<find>] [<replace>]] { | |||
?<field> <value> | |||
|
|||
[defer] | |||
|
|||
# a match condition | |||
match [status <code...> | header <field> <value>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one's a bit strange cause it's not optional to provide a matcher, so the []
are sorta misplaced.
I think we should probably replace these to just <response_matcher...>
instead, similar to how we have <matcher>
in places where a request matcher can go. We can add a jquery blob at the top to transform those into links to https://caddyserver.com/docs/caddyfile/response-matchers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match
directive added in 2.9.1 header:match
subdirective for response matching caddy#6765<find>
is parsed as a regex.