You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[docs]: Incorrect docs for present_match HeaderMatcher #17345
Title: Incorrect docs for present_match HeaderMatcher
Description:
The docs for present_match state the following:
If specified as false, header match will be performed based on whether the header is absent.
This is not the case, as setting the present_match to false doesn't check for the absence of the header, the behavior is exactly the same as when present_match is set to true
Relevant Links:
This is a related issue that describes the problem, however, the docs still state false would check for absence.
I found a newer issue/PR where this functionality was supposed to fix it (#14656), however, it's not clear if the behavior is by design (i.e. you must the combination of present_match=false and invert_match=true to check for an absence of the header).
Using the config below (with present_match=false) the behavior I'd expect is the following:
curl localhost:10000 - hello header is not present and I should get the HTTP 200 and Hello response back.
curl -H "hello: 1" localhost:1000 - hello is header is present, I should get back a 404 (since we're looking for the absence of the header).
The actual behavior is like this:
curl localhost:10000 - I get back HTTP 404 which is by my logic wrong; I am looking for the absence of hello header, hence the request should go through
curl -H "hello: 1" localhost:1000 - I get back the HTTP 200 response which is wrong again.
Based on this, regardless of the present_match value, it always checks for the presence of the header.
I tested your config, I can get HTTP status code 200 with request 'curl localhost:10000'. Also, I can get 404 with 'curl localhost:10000 -H 'hello: world'
Which version you are testing? The fixed is just merge in main, not release yet. so it works with main branch.
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.
Activity
phlax commentedon Jul 15, 2021
@peterj i dont know so much about this specific issue but if you create a PR to fix the docs im happy to review and/or ping others that do
peterj commentedon Jul 15, 2021
I found a newer issue/PR where this functionality was supposed to fix it (#14656), however, it's not clear if the behavior is by design (i.e. you must the combination of
present_match=falseandinvert_match=trueto check for an absence of the header).Using the config below (with
present_match=false) the behavior I'd expect is the following:curl localhost:10000-helloheader is not present and I should get the HTTP 200 and Hello response back.curl -H "hello: 1" localhost:1000-hellois header is present, I should get back a 404 (since we're looking for the absence of the header).The actual behavior is like this:
curl localhost:10000- I get back HTTP 404 which is by my logic wrong; I am looking for the absence ofhelloheader, hence the request should go throughcurl -H "hello: 1" localhost:1000- I get back the HTTP 200 response which is wrong again.Based on this, regardless of the
present_matchvalue, it always checks for the presence of the header.envoy-config.yaml
soulxu commentedon Jul 16, 2021
@peterj #14656 was fixed by #16627
I tested your config, I can get HTTP status code 200 with request 'curl localhost:10000'. Also, I can get 404 with 'curl localhost:10000 -H 'hello: world'
Which version you are testing? The fixed is just merge in main, not release yet. so it works with main branch.
peterj commentedon Jul 19, 2021
ah, you're completely right. I was using the released versions (1.18.x and 1.19).
github-actions commentedon Aug 19, 2021
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
github-actions commentedon Aug 26, 2021
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.
hanjm commentedon Jul 7, 2022
still valid
soulxu commentedon Jul 7, 2022
@hanjm I tested this on the main branch, it works as expected. Would you like show your envoy config? and which version you are running on?
I tested with config:
Then without header, it will match: