<p>I'm trying to use rewrite target from kubernetes with <code>gcloud</code> but it doesn't seem to be respected. My code is the following. Maybe there's something I'm not seen:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: demo-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    kubernetes.io/ingress.global-static-ip-name: projectip
spec:

  rules:
  - host: mycustomdomain.com
    http:
      paths:
      - path: /*
        backend:
          serviceName: frontend
          servicePort: 80
      - path: /api/*
        backend:
          serviceName: backend
          servicePort: 80
</code></pre>

<p>When I do <code>curl mycustomdomain.com/api/something</code> my backend is always receiving <code>backend/api/something</code> instead of <code>backend/something</code>. I'm really out of ideas and I could use some help. </p>

<p>I am assuming you are using the kubernetes ingress-nginx.</p>

<p>Looking at your ingress manifest, it seems like the rewrite annotation is wrong.</p>

<p>According to the documentation it should be:
nginx.ingress.kubernetes.io/rewrite-target</p>

<p>Here's the link to th documentation:</p>

<p><a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md#rewrite" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md#rewrite</a></p>
