Skip to content

fix: prevent configuring requestMirror filter and directResponse/RequestRedirect filter together - #7474

Merged
zhaohuabing merged 3 commits into
envoyproxy:mainfrom
zhaohuabing:fix-7473
Dec 15, 2025
Merged

zhaohuabing merged 3 commits into
envoyproxy:mainfrom
zhaohuabing:fix-7473

Conversation

@zhaohuabing

@zhaohuabing zhaohuabing commented Nov 10, 2025 •

Copy link
Copy Markdown
Member

Fixes #7473
Release Notes: Yes

@zhaohuabing
zhaohuabing requested a review from a team as a code owner November 10, 2025 07:56
@zhaohuabing
zhaohuabing marked this pull request as draft November 10, 2025 07:56
@zhaohuabing zhaohuabing changed the title fix: mirror filter can't be used with direct response fix: prevent configuring requestMirror filter and directResponse filter together Nov 10, 2025
@codecov

codecov Bot commented Nov 10, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.32%. Comparing base (343aeb3) to head (7abab91).
⚠️ Report is 470 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7474      +/-   ##
==========================================
- Coverage   72.42%   72.32%   -0.10%     
==========================================
  Files         234      234              
  Lines       34538    34550      +12     
==========================================
- Hits        25013    24988      -25     
- Misses       7737     7768      +31     
- Partials     1788     1794       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

cnvergence
cnvergence previously approved these changes Nov 10, 2025
@zhaohuabing
zhaohuabing force-pushed the fix-7473 branch 2 times, most recently from 07b6933 to 1983322 Compare November 11, 2025 02:13
@zhaohuabing zhaohuabing changed the title fix: prevent configuring requestMirror filter and directResponse filter together fix: prevent configuring requestMirror filter and directResponse/RequestRedirect filter together Nov 11, 2025
@zhaohuabing
zhaohuabing force-pushed the fix-7473 branch 3 times, most recently from cd6cef5 to 66471dc Compare November 17, 2025 12:41
cnvergence
cnvergence previously approved these changes Nov 17, 2025
@cnvergence

Copy link
Copy Markdown
Member

/retest

name: gateway-1
sectionName: http
rules:
- matches:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a mixed rule case, where one rule is valid and one isnt, to make sure the valid rule is not impacted

@zhaohuabing zhaohuabing Nov 18, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Gateway API specific, The HTTPRouteAccepted condition should be set to false with IncompatibleFilters reason when there are incompatible filters present on a route rule.

https://github.com/kubernetes-sigs/gateway-api/blob/f24f3a61f398c65ab629da1843cb65fd5ec9419f/apis/v1/shared_types.go#L384-L387

And EG skips the HTTPRoutes with Accepted status as False, which is reasonable as the entire HTTPRoute has been rejected.

if parentRef.HasCondition(httpRoute, gwapiv1.RouteConditionAccepted, metav1.ConditionFalse) {
continue
}

@zhaohuabing zhaohuabing Nov 18, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the Gateway API spec again, it seems that we should set Accepted as true as long as at least one rule is valid and implemented, even if some other rules in the same HTTPRoute are invalid.

// A Route MUST be considered "Accepted" if at least one of the Route's
// rules is implemented by the Gateway.

Changing this behavior would require a global update and could affect other cases as well. We'd better handle it in a separate PR. If we agree on this, I can raise a PR to address it first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah can we tackle this as part of #7545 and then start adding more fail fast cases

@zhaohuabing zhaohuabing Dec 3, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arkodg the translation for mixed valid and invalid rules has been addressed in #7625, and this one is ready for review whenever you have a moment.

@zhaohuabing
zhaohuabing requested a review from arkodg November 18, 2025 06:39
@zhaohuabing
zhaohuabing marked this pull request as draft November 18, 2025 06:40
@zhaohuabing
zhaohuabing force-pushed the fix-7473 branch 3 times, most recently from 3248085 to 88321e2 Compare December 3, 2025 10:53
@zhaohuabing
zhaohuabing marked this pull request as ready for review December 3, 2025 10:53
@zhaohuabing
zhaohuabing requested review from a team and cnvergence December 3, 2025 10:53
@zhaohuabing zhaohuabing added this to the v1.7.0-rc.1 Release milestone Dec 11, 2025
@arkodg

arkodg commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

worth adding a release note around breaking change, something like

  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /foo
    filters:
    - type: RequestRedirect
      requestRedirect:
        scheme: https
        statusCode: 302
    - type: ResponseHeaderModifier
      responseHeaderModifier:
        add:
        - name: X-Bad
          value: "bad\nvalue"   # invalid per HeaderValueRegexp

will no longer work

@zhaohuabing

Copy link
Copy Markdown
Member Author

worth adding a release note around breaking change, something like

  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /foo
    filters:
    - type: RequestRedirect
      requestRedirect:
        scheme: https
        statusCode: 302
    - type: ResponseHeaderModifier
      responseHeaderModifier:
        add:
        - name: X-Bad
          value: "bad\nvalue"   # invalid per HeaderValueRegexp

will no longer work

I might be missing somthing, but this PR doesn't touch the code for responseHeaderModifier validation logic.

There is already a release note for the breaking change introduced in this PR:

 Set HTTPRoute Accepted status to False when RequestMirror filter is used together with DirectResponse or RequestRedirect filters.
 

@arkodg
arkodg requested review from a team December 14, 2025 07:19
…ether

Signed-off-by: Huabing Zhao <[email protected]>

check redirect respose filter

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
@zhaohuabing
zhaohuabing merged commit 92d2a1a into envoyproxy:main Dec 15, 2025
@zhaohuabing
zhaohuabing deleted the fix-7473 branch December 15, 2025 08:33
millermatt pushed a commit to millermatt/envoy-gateway that referenced this pull request Jan 4, 2026
…estRedirect filter together (envoyproxy#7474)

* fix: prevent configuring RequestMirror and DirectResponse filters together

Signed-off-by: Huabing Zhao <[email protected]>

check redirect respose filter

Signed-off-by: Huabing Zhao <[email protected]>

* address comments

Signed-off-by: Huabing Zhao <[email protected]>

* fix lint

Signed-off-by: Huabing Zhao <[email protected]>

---------

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Matt Miller <[email protected]>
rudrakhp pushed a commit to rudrakhp/gateway that referenced this pull request Apr 15, 2026
…estRedirect filter together (envoyproxy#7474)

* fix: prevent configuring RequestMirror and DirectResponse filters together

Signed-off-by: Huabing Zhao <[email protected]>

check redirect respose filter

Signed-off-by: Huabing Zhao <[email protected]>

* address comments

Signed-off-by: Huabing Zhao <[email protected]>

* fix lint

Signed-off-by: Huabing Zhao <[email protected]>

---------

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>
rudrakhp added a commit that referenced this pull request Apr 16, 2026
* fix: avoid metric increments on no-op delete reconcile paths (#8480)

* fix: avoid metric increments on no-op delete reconcile paths

Signed-off-by: Felipe Sabadini Facina <[email protected]>

* Update internal/infrastructure/kubernetes/infra_resource_test.go

Signed-off-by: Isaac Wilson <[email protected]>

* Update internal/infrastructure/kubernetes/infra_resource_test.go

Signed-off-by: Isaac Wilson <[email protected]>

---------

Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Isaac Wilson <[email protected]>
Co-authored-by: Isaac Wilson <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: restore failure-path metric recording for delete and HPA reconcile (#8656)

Fixes #8651

Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: helm secrets rbac for gateway namespace with watch list of namespaces (#8706)

* fix: helm secrets rbac for gateway namespace with watch list of namespaces

Signed-off-by: Karol Szwaj <[email protected]>

* add release notes

Signed-off-by: Karol Szwaj <[email protected]>

* review update

Signed-off-by: Karol Szwaj <[email protected]>

---------

Signed-off-by: Karol Szwaj <[email protected]>
Co-authored-by: Rudrakh Panigrahi <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: handle network errors in rate limit e2e tests (#8446)

Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: propagate the HTTPFilter translation errors to the outer layer (#7556)

* progate the HTTPFilter validation errors to the outer layer

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: return 500 error for invalid filters (#7605)

return 500 error for invalid filters

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: prevent configuring requestMirror filter and directResponse/RequestRedirect filter together (#7474)

* fix: prevent configuring RequestMirror and DirectResponse filters together

Signed-off-by: Huabing Zhao <[email protected]>

check redirect respose filter

Signed-off-by: Huabing Zhao <[email protected]>

* address comments

Signed-off-by: Huabing Zhao <[email protected]>

* fix lint

Signed-off-by: Huabing Zhao <[email protected]>

---------

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix bug with grpcroute mirror filter (#8541)

* fix bug with grpcroute mirror filter

Signed-off-by: Adam Buran <[email protected]>

* add indexers test

Signed-off-by: Adam Buran <[email protected]>

* add release note

Signed-off-by: Adam Buran <[email protected]>

---------

Signed-off-by: Adam Buran <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Co-authored-by: Arko Dasgupta <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: normalize CRLF line endings in htpasswd basic auth secrets (#8557)

Fixes #8554

Signed-off-by: stekole <[email protected]>
Signed-off-by: stekole <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: status for mirror backend (#8675)

Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: set HTTPRoute Accepted condition as true with mixed invalid and valid rules (#7625)

* set HTTPRoute Accepted condition as true with mixed invalid and valid rules

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: basic auth validation (#8053)

* fix basic auth validation

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* [release/v1.6] fix gen check

Signed-off-by: Rudrakh Panigrahi <[email protected]>

---------

Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Isaac Wilson <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Adam Buran <[email protected]>
Signed-off-by: Arko Dasgupta <[email protected]>
Signed-off-by: stekole <[email protected]>
Signed-off-by: stekole <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: Felipe Sabadini <[email protected]>
Co-authored-by: Isaac Wilson <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: aburanrbx <[email protected]>
Co-authored-by: Arko Dasgupta <[email protected]>
Co-authored-by: stekole <[email protected]>
Co-authored-by: Kota Kimura <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RequestMirror silently fails when HTTPRoute is configured with a filter with direct response

5 participants