How do I include the original url as a request parameter, when proxying?

By | December 7, 2017

I want to proxy the incoming requests with an nginx instance to a little java backend application. The idea is that I want every original request’s uri to be included as a request parameter i.e. something like:

location / {
            proxy_pass http://localhost:9000?url=$request_uri;

but it does not work

proxy_pass http://localhost:9000$request_uri

The @request_uri is equal to the original request URI as received from the client including the args.

The $request_uri of this post is /questions/16188521/how-do-i-include-the-original-url-as-a-request-parameter-when-proxying.


Leave a Reply

Your email address will not be published. Required fields are marked *