Skip to content

RegularExpression match bug: Istio routing picks the wrong path #58441

@bedier7

Description

@bedier7

Is this the right place to submit this?

  • This is not a security vulnerability or a crashing bug
  • This is not a question about how to use Istio

Bug Description

I'm using Istio (1.27.2) with the Kubernetes Gateway API (1.4) as the main Gateway for our cluster. I’m seeing unexpected behavior when combining RegularExpression path matches and PathPrefix matches across different HTTPRoute resources.

Problem

I have two HTTPRoute objects:

Route A – should match specific regex paths and forward to Service A:
matches:

  • path:
    type: RegularExpression
    value: "/api/test/[0-9a-z-]+"

Route B – a generic fallback route to Service B:
matches:
- path:
type: PathPrefix
value: /api

Expected behavior:
when i hit something like /api/test/check
i should go to service A
but i see all of my requests go to Service B
with checking logs , i see matched route for all requests is Route B

Debugging Findings
using:
istioctl proxy-config routes <pod> -n istio-system
i see paths with PathPrefix type always on top of RegularExpression paths

important note:
when i added general path with Prefix /
when i checked proxy-config routes again , i see all regex paths disappeared

Version

istioctl version: 1.27.2
kubectl version   1.33.5
Server Version: v1.33.5
helm version:  v3.16.2+g13654a5

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions