feat(BackendTrafficPolicy): Support matching on response header for response override - #9354
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
e2cc8fa to
e55ccd8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2cc8fa982
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Matching on request headers was merged and released in Envoy 1.39. Once this is merged, I can implement also the request headers part. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9354 +/- ##
==========================================
+ Coverage 76.18% 76.21% +0.03%
==========================================
Files 261 261
Lines 43528 43606 +78
==========================================
+ Hits 33162 33236 +74
+ Misses 8165 8163 -2
- Partials 2201 2207 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…nse headers in addition to response status codes Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
…nse headers Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
6daffcc to
c5fc326
Compare
Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
…ith-response-header-match
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3aba51d06b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
zhaohuabing
left a comment
There was a problem hiding this comment.
RegularExpression values are not validated → invalid regex reaches Envoy
buildResponseOverride (internal/gatewayapi/backendtrafficpolicy.go:2529) calls irStringMatch and never validates the pattern. Everywhere else in the translator, user-supplied regexes go through regex.Validate() — including the sibling code in the same file for header/path/query matches (backendtrafficpolicy.go:2126, :2181, :2240), plus route.go:1175, securitypolicy.go:2978. Envoy's RegexMatcher.regex PGV constraint is only min_bytes: 1, so proto.ToAnyWithValidation won't catch it either.
Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
…redicates could be expressed in the CR Signed-off-by: kabbohus <hussein.kabbout@united-security-providers.ch>
What this PR does / why we need it:
This PR was created because we would like to be able to generate something similar to the following envoy native config:
#8608 and #8856 were created in the past but they talk about supporting request header matching, which envoy does not support (yet ;D). What would be nice for now is support the response header matching, which envoy currently supports, in envoy gateway. In the future, request headers can be easily added since they would be very similar to the response header implementation.
The main use case for this is custom error pages which should return different response bodies based on the response content-type (see example from above).
PR Checklist
git commit -s). See DCO: Sign your work./api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.make generate gen-check,make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, butgen-check,lint, and coverage MUST pass.)release-notes/current/<section>/<pr-number>-<slug>.md(seerelease-notes/current/README.mdfor sections and naming). N/A if this PR does not contain non-trivial changes.make gen-checkand committed the result if API/helm charts/modules changed.release-notes/current/breaking_changes/.