<p>In our Kubernetes Cluster, We have a requirement to do a string replace in our Response body. Is there such a thing in Istio for response content modification. I could only find header manipulation.</p>

<p>Can Nginx Ingress Controller do this?</p>

<p>The respone contains html content with hrefs as:   &lt;>"/static/myimages/logo.png"&lt;>
We would like to modify this response to prefix it with &lt;>"/myapp/static/myimages/logo.png"&lt;></p>

<p>Does anyone have a recommendation for a gateway that can do this content rewrite. 
Do you have samples to share?</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: resource-manager
spec:
  hosts:
  - "*"
  gateways:
  - myapp-gateway
  http:
  - match:
    - uri:
       prefix: /myapp/
      rewrite:
       uri: "/"
    route:
     - destination:
        host: myapp.voting.svc.cluster.local
        port:
          number: 9099
       headers:
        response:
         add:
          foo: bar
</code></pre>

<p>I started looking at other Ingress Controllers and found that NGINX-Ingress can do response manipulation. Here is an ingress route I setup which does content manipulation. Sharing that here:</p>

<pre><code>apiVersion: extensions/v1beta1 
kind: Ingress 
metadata: 
  name: app1-ingress 
  namespace: app1 
  annotations:
    nginx.ingress.kubernetes.io/configuration-snippet: |
      sub_filter '&lt;title&gt;My title' '&lt;title&gt;My updated title'; #This changes title that Chrome Shows on Top
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /$1 
spec:  
 rules:
  - http:
      paths:
      - backend:
          serviceName: app1
          servicePort: 8080
        path: /app1/(.*)
</code></pre>
