<p>For example</p>
<pre><code>- host: &quot;domain.com&quot;  
      http:  
        paths:  
          - path: /?(.*) # want to rewrite this with /$1  
            backend:  
              serviceName: RELEASE-NAME-svcname1  
              servicePort: 80  
          - path: /test/?(.*) # want to skip rewrite   
            backend:  
              serviceName: RELEASE-NAME-svcname2   
              servicePort: 80 
</code></pre>
<p>Any way to handle this in a single ingress ?</p>

Wakeupcolumn
<blockquote>
<p>Any way to handle this in a single ingress?</p>
</blockquote>
<p>Not in a single Ingress resource, no, but it will work fine with a single ingress controller.</p>
<p>The reason you need to create two separate Ingress resources is so that you can apply the annotation to one but not the other; all Ingress resources across the whole cluster are unioned together, then grouped by virtual host, in the ultimate emitted nginx.conf</p>
<pre class="lang-yaml prettyprint-override"><code>...
metadata:
  name: ingress-svc-1
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
    ...
    - host: &quot;domain.com&quot;  
      http:  
        paths:  
          - path: /?(.*) # want to rewrite this with /$1  
            backend:  
              serviceName: RELEASE-NAME-svcname1  
              servicePort: 80  
---
...
metadata:
  name: ingress-svc-2
spec:
    ...
    - host: &quot;domain.com&quot;  
      http:
        paths:
          - path: /test/?(.*)
            backend:
              serviceName: RELEASE-NAME-svcname2   
              servicePort: 80 
</code></pre>
