How can I fetch request URI in ingress configuration-snippet?

5/24/2020

I want to read the request URI(excluding hostname and request params) and forward it in a custom header to an upstream server. I have been through several blogs where they have mentioned to use $request_uri but its not working.

nginx.ingress.kubernetes.io/configuration-snippet: |
    proxy_set_header RequestURI $request_uri

May I know which language is used to write scripts in annotation snippets? And is there is any list of variables which are by-default provided by ingress controller that we can use inside annotations?

Thanks

-- Jaraws
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

5/24/2020

which language is used to write scripts in annotation snippets?

There are no special language, the format is the Nginx configuration format.

Everything you put there will be added to a location section related to your Ingress route in an Nginx configuration generated by Ingress controller.

is there is any list of variables which are by-default provided by ingress controller that we can use inside annotations?

Here is a list of embedded Nginx variables.

-- Anton Kostenko
Source: StackOverflow