title: nginx - Passing request header variables to upstream URL as query parameter
body: <p>I have an application running on localhost listening on port 8080</p>
  
  <p>nginx is running as reverse proxy, listening on port 80</p>
  
  <p>So, a request coming to nginx on port 80 is sent to this application listening on localhost:8080 and response from this application sent back to the user</p>
  
  <p>Now this application is incapable of reading the header variables from request header and can read only query parameters</p>
  
  <p>So I want nginx to pass header values as query parameters to this application listening on localhost:8080</p>
  
  <p>E.g. let us say in the request header there is a custom variable called 'userid'.</p>
  
  <p>How do we pass this userid as &amp;userid=value appended to the url to application listening on localhost 8080</p>
  
  <p>My current test file of site-available and site-enabled is</p>
  
  <pre><code>server {
  
      location /test {
  
          proxy_pass http://localhost:8080;
      }
  
  }
  </code></pre>