I have my nginx proxy pass config setup as follows:

location /try-me {
   proxy_pass https://some-domain.com?id=true&zone=false

This works fine. But the problem is when someone from the browser tries


The final URL that gets created after the proxy_pass is:


The query parameter formation is completely incorrect. How can I make sure that Nginx appends any query parameters forwarded in the following manner:


1 Answer 1


It may be better to use rewrite...break rather than trying to get proxy_pass to do it properly.

For example:

location /try-me {
    rewrite ^ /?id=true&zone=false break;
    proxy_pass https://some-domain.com;

The rewrite directive will append the original parameters correctly. See this document for details.

In the above example, any URI that begins with /try-me will be rewritten to / with the adjusted query string.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .