Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VirtualService HTTPMatchRequest.regex breaks when using pipes #10766

Closed
mehemken opened this issue Jan 6, 2019 · 3 comments
Closed

VirtualService HTTPMatchRequest.regex breaks when using pipes #10766

mehemken opened this issue Jan 6, 2019 · 3 comments

Comments

@mehemken
Copy link

mehemken commented Jan 6, 2019

Describe the bug

As seen on StackOverflow.

The pipe character does not seem to work in Istio's VirtualService.

The example below is intended to route requests based on the user-agent header. Requests from a mobile device should go to myapp and requests from a desktop user should go to deskt-app, handled by next match block. The <REGEX> field works when I use this regex:

^.*\bMobile\b.*$

But the powers that be require a more sophisticated regex to identify mobile users. My routing breaks entirely when I use these:

^.*\b(iPhone|Pixel)\b.*$
^.*\b(iPhone|Pixel)+\b.*$
^.*\biPhone|Pixel\b.*$

Expected behavior

Using a regex with a pipe (logical OR) I expect to be routed to myapp when I have a user-agent header that contains the word "iPhone" or "Pixel".

Actual behavior

I get routed to deskt-app.

Steps to reproduce the bug

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
  ...
  ...
  http:
  - match:
    - headers:
        user-agent:
          regex: "<REGEX>"    <------
      uri:
        prefix: /foo/bar
    route:
    - destination:
        host: myapp
        port:
          number: 80
  - match:
    - uri:
        prefix: /foo/bar
    route:
    - destination:
        host: deskt-app
        port:
          number: 80

Version

K8s
kubectl Client: 1.9.9
kubectl Server: 1.10.9-gke.5

Istio
Version: 1.0.5
GitRevision: c1707e4
User: root@6f6ea1061f2b
Hub: docker.io/istio
GolangVersion: go1.10.4
BuildStatus: Clean

Installation
With the Helm chart.

Environment
GKE

@mehemken
Copy link
Author

mehemken commented Jan 6, 2019

This is superficially similar to #10666 , however, my application is in fact sending the user-agent header.

@mehemken mehemken changed the title VirtualService HTTPMatchRequest.regex ignores pipes and breaks VirtualService HTTPMatchRequest.regex ignores/breaks when using pipes Jan 6, 2019
@mehemken mehemken changed the title VirtualService HTTPMatchRequest.regex ignores/breaks when using pipes VirtualService HTTPMatchRequest.regex breaks when using pipes Jan 6, 2019
@mehemken
Copy link
Author

mehemken commented Jan 7, 2019

The Stackoverflow question got answered. I will try the change in regex and report if it works or not.

@mehemken
Copy link
Author

mehemken commented Jan 7, 2019

Unfortunately the project was nixed before I could verify the Stackoverflow answer.

@mehemken mehemken closed this as completed Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant