title: Is there a best practice to implement ingress rule with rewrite to root
body: <p>For example, I have a rule (<a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/examples/rewrite/</a>):</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      nginx.ingress.kubernetes.io/rewrite-target: /$2
    name: rewrite
    namespace: default
  spec:
    rules:
    - host: rewrite.bar.com
      http:
        paths:
        - backend:
            serviceName: http-svc
            servicePort: 80
          path: /something(/|$)(.*)
  </code></pre>
  
  <p>So anything that goes to <code>rewrite.bar.com/something</code> will go to <code>http-svc/</code>. And if <code>http-svc</code> will answer another location, e.g. <code>/static</code> there will be redirect to <code>rewrite.bar.com/static</code> and here we go - 404. I wonder is there any simple and clear solution to fix such situations without asking the developer to implement proxy_path variable or something like that?</p>
  
  <p>Tried <a href="https://stackoverflow.com/questions/55718282/make-links-in-response-relative-to-new-path">Make links in response relative to new path</a></p>