Ceci Ivanov:
annotations:
<http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /
can anyone explain me this one
Ceci Ivanov:
annotations:
<http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /
can anyone explain me this one
Shwetha Shenoy V:
That annotation means if your url is http://www.somedomain.com/watches|www.somedomain.com/watches, it will be routed to the root(/) of the backend service in the k8s cluster.
Without this annotation, http://www.somedomain.com/watches|www.somedomain.com/watches will be redirected to backendservice:port/watches
Does that help?
Shwetha Shenoy V:
If your backendservice:port exposes /watches to handle this request, then you dont need the rewrite target annotation.
unnivkn:
Hi @Ceci Ivanov fyr: https://serverfault.com/questions/1017356/how-to-rewrite-url-to-backend-while-preserving-browser-url-in-nginx-ingress
Ceci Ivanov:
But i dont get it when exactly i will need this? how can i know that ii need this one
unnivkn:
Hi @Ceci Ivanov let’s say there are some famous website like <http://kodekloud.com|kodekloud.com>
, millions of customers are using. One fine day due to some technical reason, they are migrating it to <http://kodekloud.com/v2|kodekloud.com/v2>
. Now it is very difficult to inform all the customers about the change’s in their website URL and at the same time all the customers may not be aware of these changes.
So what we can do here is whatever client request/hits happening on the website <http://kodekloud.com|kodekloud.com>
, automatically route to <http://kodekloud.com/v2|kodekloud.com/v2>
. This will be handled internally. So the customers still can access the old website(<http://kodekloud.com|kodekloud.com>
) and it won’t impact the business. Hope this helps.