How to replace the full url in nginx ingress?
For example:
example.com/some/uri/<servicename> -> <servicename>/other/uri/path
Asked
Active
Viewed 452 times
2

Stoned_Fox
- 61
- 1
- 4
-
I think host header must be set, otherwise it will be automatically assign. you can change it - you take a look https://github.com/nginxinc/kubernetes-ingress/issues/209 https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#custom-nginx-upstream-vhost https://stackoverflow.com/questions/54624647/is-it-possible-to-rewrite-host-header-in-k8s-ingress-controller ? – Malgorzata Feb 09 '21 at 10:03
-
Hi @Malgorzata! Thanks you for your answer. I don't need to go to an external host, I need to proxy the request to my service in k8s. I just need to specify a different uri for everyone. – Stoned_Fox Feb 09 '21 at 10:10
-
Did you try to use nginx.ingress.kubernetes.io/rewrite-target annotation? Check examples https://github.com/kubernetes/ingress-nginx/tree/master/docs/examples/rewrite#exampleshttps://stackoverflow.com/questions/61185530/another-nginx-ingress-rewrite-target-problemhttps://stackoverflow.com/questions/47837087/nginx-ingress-rewrite-target https://stackoverflow.com/questions/56277518/how-to-configure-nginx-ingress-kubernetes-io-rewrite-target-and-spec-rules-http https://github.com/kubernetes/ingress-nginx/issues/3122? – Malgorzata Feb 09 '21 at 11:24
-
Did links provided by me are useful ? – Malgorzata Feb 16 '21 at 12:35