<p>I have a workload which is exposed through <code>NodePort</code> service with the name <code>online-forms-lib-service</code>. This workload has the <code>/version</code> route.</p>

<p>Also I have the following ingress:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          serviceName: online-forms-lib-service
          servicePort: 80
        path: /formslib/
</code></pre>

<p>The problem is, the <code>/version</code> route is not available at:</p>

<pre><code>example.com/formslib/version
</code></pre>

<p>How to solve this?</p>

<p><strong>Update</strong> </p>

<p>It goes to the application root when I call: </p>

<pre><code>example.com/formslib/
</code></pre>

<p>Adding any path from there directs me to the default backend</p>

<p><strong>Update</strong>
Added the annotation: </p>

<pre><code>  annotations:
    ingress.kubernetes.io/rewrite-target: /
</code></pre>

<p>Still the same behaviour.</p>

<p>This behaviour is controlled by the <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer">rewrite</a> annotations.</p>

<pre><code>  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
</code></pre>

<p>As of September, 2019, the GKE ingress doesn't support the <code>rewrite</code> rules.</p>

<p><a href="https://github.com/kubernetes/ingress-gce/issues/109" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-gce/issues/109</a></p>

<p>And no published plans for implementing it either.</p>

<p>The only solution is nginx or other 3rd party ingress controller which supports rewrite annotations.</p>
