<p>Inside the virtual service, I have routed 2 paths to my service as follows -</p>
<pre class="lang-yaml prettyprint-override"><code>- match:
    - uri:
        prefix: /jaeger/
    - uri:
        regex: \/oauth2\/.*jaeger.*
    route:
    - destination:
        host: oauth2-proxy
        port:
          number: 80
</code></pre>
<p>But the gateway returns 404 when I send request on the path <code>/oauth2/callback?code=3QxQLUqCwxVtH_GS6mWteICfisIe32yE7RE6wQIZZVw&amp;state=wmZSZ0BHMHq3vmS_1YBWIn72pG6FkChFQbNUNipGotQ%3A%2Fjaeger%2F</code></p>
<p>Now, I could also just use the prefix <code>/oauth2/</code> to handle such URLs but currently I have multiple applications that are being authenticated by their own oauth2-proxies and this regex would match all of them. So I need to use a regex which contains the application name inside it, such as jaeger is this case.</p>
<p>I even checked on <a href="https://regex101.com/" rel="nofollow noreferrer">regex101</a> that this path is indeed matching the regex I used.</p>
<p>Also, the gateway routes the request successfully when I use the regex <code>\/oauth2\/.*</code>. But as I explained I can't use this regex either. Am I missing something here?</p>
<p>Edit:
After further testing, I found out that if remove the &quot;?&quot; from the path, istio accepts this as valid and forwards the request to the service.
I also tried the regex <code>/oauth2\/callback\?code=.*jaeger.*</code> but that isn't working either.</p>

Hemabh
<p>I did not realize that &quot;?&quot; marks the end of a URL and everything after that are query parameters. Istio provides matching of query parameters as well. The following code worked in my case -</p>
<pre><code>  - match:
    - uri:
        prefix: /jaeger/
    - uri:
        regex: \/oauth2\/callback?.*
      queryParams:
        state: 
          regex: .*jaeger.*
    route:
    - destination:
        host: oauth2-proxy
        port:
          number: 80
</code></pre>
