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
https://mywebsite.com/try-me?ping=true&foo=bar
The final URL that gets created after the proxy_pass is:
https://some-domain.com?id=true&zone=false?ping=true&foo=bar
The query parameter formation is completely incorrect. How can I make sure that Nginx appends any query parameters forwarded in the following manner:
id=true&zone=false&ping=true&foo=bar
It may be better to use
rewrite...break
rather than trying to getproxy_pass
to do it properly.For example:
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.