<p>I have an Ingress / Terraform / NGINX / Kubernetes setup that has issues with properly redirecting, it's currently serving a vue.js frontend and a .NET Core backend, both of these work online. However, when adding another Vue.JS instance it doesn't seem to properly redirect to said URL.</p>
<p>My terraform setup</p>
<pre><code>resource &quot;kubernetes_ingress&quot; &quot;ingress&quot; {
    metadata {
     name      = &quot;ingress&quot;
     namespace = var.namespace_name
     annotations = {
       &quot;nginx.ingress.kubernetes.io/force-ssl-redirect&quot; = true
       &quot;nginx.ingress.kubernetes.io/from-to-www-redirect&quot; = true
       &quot;nginx.ingress.kubernetes.io/ssl-redirect&quot;: true
       &quot;kubernetes.io/ingress.class&quot;: &quot;nginx&quot;
     }
    }

spec {
 tls {
  hosts = [var.domain_name, &quot;*.${var.domain_name}&quot;]
  secret_name = &quot;tls-secret&quot;
 }
rule {
  host = var.domain_name
  http {
    path {
      path = &quot;/&quot;
      backend {
        service_name = &quot;frontend&quot;
        service_port = 80
      }
    }

    path {
      path = &quot;/api&quot;
      backend {
        service_name = &quot;api&quot;
        service_port = 80
      }
    }

    path {
      path = &quot;/backend/*&quot;
      backend {
        service_name = &quot;backend&quot;
        service_port = 80
      }
    }

    path {
      path = &quot;/payment/*&quot;
      backend {
        service_name = &quot;payment&quot;
        service_port = 80
      }
    }

  }
}
}

wait_for_load_balancer = true
}
</code></pre>
<p>When running <code>kubectl describe</code> the following is returned</p>
<pre><code>Name:             ingress
Namespace:        [redacted]
Address:          [ip-address]
Default backend:  default-http-backend:80 (&lt;none&gt;)
TLS:
 tls-secret terminates [url-name],*.[url-name]
Rules:
  Host            Path  Backends
  ----            ----  --------
  [url-name]
              /           frontend:80 (10.244.0.97:80)
              /api        api:80 (10.244.0.121:80)
              /backend/   backend:80 (10.244.0.96:80)
              /payment/   payment:80 (10.244.0.32:80)
  Annotations:
    nginx.ingress.kubernetes.io/force-ssl-redirect:    true
    nginx.ingress.kubernetes.io/from-to-www-redirect:  true
    nginx.ingress.kubernetes.io/ssl-redirect:          true
</code></pre>
<p>I was thinking I might be missing proxy settings but I have no idea how to redirect that. Furthermore, this entire solution is deployed with CI and to digital ocean. I've tried various other configurations such as removing the asterix in the paths <code>/backend/</code> but this didn't change anything.</p>
<p>In annotations adding <code>nginx.ingress.kubernetes.io/rewrite-target: /</code> only broke the <code>/api</code> URL and didn't fix the others.</p>
<p>EDIT* adding <code>&quot;kubernetes.io/ingress.class&quot;: &quot;nginx&quot;</code> like @Vitalii mentioned unfortunately did not fix the issue. Question has been updated for completeness sake</p>

RDAxRoadkill
<p>Adding <code>nginx.ingress.kubernetes.io/rewrite-target: /</code> was actually part of the solution, it did break the .NET C# API which made me ask a separate question that can be found <a href="https://stackoverflow.com/questions/63597967/nginx-ingress-rewrite-target-breaks-link-to-net-core-api">here</a> for consistency &amp; future searches sake the solution I've used was as follows. apart from adding the rewrite target line in my <code>annotations</code> changing the API path from</p>
<pre><code> path {
  path = &quot;/api(.*)&quot;
  backend {
    service_name = &quot;api&quot;
    service_port = 80
  }
}
</code></pre>
<p>Into</p>
<pre><code>     path {
      path = &quot;/(api.*)&quot;
      backend {
        service_name = &quot;olc-api&quot;
        service_port = 80
      }
    }
</code></pre>
<p>With this it matches the /api to my .NET core app, instead of it trying to find a URL within the vue.js container(s)</p>
