<p>I am having difficulty in understanding the rewrite annotation in k8s ingress. Can someone please help me in understanding it with an example.</p>

<p>For Eg: </p>

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

<p>I checked this <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer">Link</a> out but it's still not very clear how the slashes and arguments work out here.</p>

<p>Thanks !</p>

Naxi
<p>Please refer to <a href="https://stackoverflow.com/questions/58604021/expose-a-kubernetes-deployment-frontend-using-ingress-controller/58604282#58604282">this</a> stackoverflow post, this will be helpful for you.</p>

<p>In this post you can see that hostname/api points to backend service, and the rewrite actually makes the url to get converted from hostname/api to hostname.</p>

<p>Rewrite comes handy when frontend and backend services are to be mapped to one hostname only</p>
