-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
header: match
subdirective for response matching
#6765
Conversation
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.
There is a slight breaking concern: similar to how "defer" cannot be used a header name, a header entry where the header name is exactly "match" will no longer be considered. If there is someone using it, they will have to rename the header to "Match" (different case) instead.
I believe this is only true when using a block; but when using the single-line syntax, there should be no conflict. IIRC.
Anyway, LGTM at a glance! Maybe @francislavoie could double-check but I think we can merge this.
j/k -- we need to fix the lint error first:
|
3d869eb
to
f4d2946
Compare
match
subdirective for response matching
Thanks for the reviews! Seem like it just needs a final round tests after rebasing on top of the recent pushes. |
Head branch was pushed to by a user without write access
@mholt Could you approve the workflow run? |
Allows the header directive to specify a response matcher to apply the header operation only when the response has a certain header or status.
This PR only adds the syntax to the caddyfile parser. The runtime uses the preexisting logic implemented for the "Require" field. I went with the
match
name for parity with theencode
directive.There is a slight breaking concern: similar to how "defer" cannot be used a header name, a header entry where the header name is exactly "match" will no longer be considered. If there is someone using it, they will have to rename the header to "Match" (different case) instead.
Syntax example: