Nginx proxy_pass all url parameters
<p>I want to proxy requests like these:
<code>http://myproxy.com/api/folder1/result1?test=1</code> <br/>, <code>http://myproxy.com/api/folder3447/something?var=one</code></p>

<p>to the equivalent destinations: <code>http://destination.com/folder1/result1?test=1</code> and <code>http://destination.com/folder3447/something?var=one</code>, practically only the domain changes and all subfolders and params are preserved</p>

<p>location in config looks like:</p>

<pre><code>location ~* ^/api/(.*) {
    proxy_pass http://destination.com/$1$is_args$args;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header  Host $http_host;
  }
</code></pre>