Skip to content

problem with all routes 404 when using incorrect filters #5182

Closed

Description

@arkodg

Same problem with all routes 404 when using filters

---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: something
spec:
  parentRefs:
    - name: eg
      namespace: something
      sectionName: something
  hostnames:
    - something.com
  rules:
    - backendRefs:
        - group: ""
          kind: Service
          name: something
          port: 123
          weight: 1
      filters:
        - type: RequestHeaderModifier
          requestHeaderModifier:
            add:
              - name: Host
                value: something.com
              - name: X-Forwarded-Proto
                value: https
              - name: X-Forwarded-Host
                value: something.com
      matches:
        - path:
            type: PathPrefix
            value: /

I understand that filters are not needed here and maybe they are written incorrectly, I'm just making a report that the problem in one httproute affects all httroutes in the cluster.

Originally posted by @dda104 in #5147

Activity

  1. added
    kind/bug
    on Jan 31, 2025
  2. added this to the Backlog milestone on Jan 31, 2025
  3. added
    help wanted
    on Jan 31, 2025
  4. modified the milestones: Backlog, v1.4.0-rc.1 on Feb 8, 2025
  5. surenraju commented on Feb 16, 2025

    @surenraju
    Contributor

    Currently, in snapshotcache.go (line 332), when Envoy rejects an xDS update, we log it at DEBUG level:

    https://github.com/envoyproxy/gateway/blob/main/internal/xds/cache/snapshotcache.go#L332

    if status := req.ErrorDetail; status != nil {
        // if Envoy rejected the last update log the details here.
        // TODO(youngnick): Handle NACK properly
        errorCode = status.Code
        errorMessage = status.Message
    }
    s.log.Debugf("handling v3 xDS resource request, response_nonce %s, nodeID %s, node_version %s, resource_names_subscribe %v, resource_names_unsubscribe %v, type_url %s, errorCode %d, errorMessage %s",
        req.ResponseNonce,
        nodeID, nodeVersion,
        req.ResourceNamesSubscribe, req.ResourceNamesUnsubscribe,
        req.GetTypeUrl(),
        errorCode, errorMessage)

    We should log this as an error s.log.Errorf instead of Debugf, since a failed xDS update might indicate a critical configuration issue.

  6. zhaohuabing commented on Feb 18, 2025

    @zhaohuabing
    Member

    @dda104 I can't reproduce the reported issue with the HTTPRoute that you pasted in EG 1.3.0. Did I miss anything?

  7. vmcdxliii commented on Feb 18, 2025

    @vmcdxliii

    @zhaohuabing try create new httproutes after one incorrect. In my case they returns 404. Also try restart k8s cluster and check httproutes.

  8. surenraju commented on Feb 18, 2025

    @surenraju
    Contributor

    The issue is reproducible. You need to apply first incorrect and the correct configurations, or you can also restart the proxy pod

  9. self-assigned this
    on Mar 18, 2025
  10. zhaohuabing commented on Mar 18, 2025

    @zhaohuabing
    Member

    This is because the RouteConfiguration was rejected by envoy: Envoy rejected the last update with code 13 and message :-prefixed or host headers may not be modified

    It's not a proto validation but a validation in Envoy source code, so EG can't catch it.

  11. arkodg commented on Mar 18, 2025

    @arkodg
    ContributorAuthor

    We could add a CEL validation upstream to not allow Host header to be modified via this filter and to use Url rewrite instead

  12. removed
    help wanted
    on Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions