<p>I'm trying to use Ambassador <code>prefix_regex</code> and <code>regex_rewrite</code>. <br>
I want both this routes prefixes:</p>
<pre><code>       /my/route/&lt;something&gt;
      /api/v1/my/route/&lt;something&gt;
</code></pre>
<p>will be mapped to:
<code>/my/route/&lt;something&gt;</code> <br>
This is what I was trying to use:</p>
<pre><code>apiVersion: ambassador/v2
kind: Mapping
prefix_regex: true
prefix: (/api/v1)?/my/route
regex_rewrite:
    pattern: &quot;/api/v1/my/route/(.*)&quot;
    substitution: &quot;/my/route/\\1&quot;
</code></pre>
<p>Using the <code>regex_rewrite</code> with regular <code>prefix</code> works as expected <br>
Using <code>prefix_regex</code> with regular <code>rewrite</code> works as expected<br>
but together I receive 404 from the envoy.</p>
<p>Any ideas?</p>
<p>I'm using Ambassador 1.7.0 version</p>

<p>Resolved by adding /.* at the end of the prefix. <br></p>
<p><code>prefix:  (/api/v1)?/my/route/.*</code> <br></p>
<p>It looks like prefix_regex adds automatically <code>$</code> at the end of the prefix, which means we need to specify the full path of the mapping and not just the prefix.</p>
