title: Move query parameter value to header before auth request in NGINX?
body: <p>I have a location that uses <a href="https://nginx.org/en/docs/http/ngx_http_auth_request_module.html" rel="nofollow noreferrer">ngx_http_auth_request_module</a>. The authorization sub-request looks for a token in an <code>Authorization</code> header on the original request. For this particular location, the token can only be passed as a query parameter on the request (e.g. <code>/sites/&lt;site-id&gt;/charts/&lt;chart-name&gt;?token=&lt;token&gt;</code>).</p>
  
  <p>Is it possible to set an <code>Authorization</code> header to <code>Bearer: &lt;token&gt;</code> (<code>&lt;token&gt;</code> being the value passed to the request as the <code>token</code> query parameter) <em>before</em> the auth sub-request is fired?</p>
  
  <p>The location:</p>
  
  <pre><code>location ~* "^\/sites\/([0-9A-Fa-f]{8}-?([0-9A-Fa-f]{4}-?){3}[0-9A-Fa-f]{12})\/charts\/([^\/]*\/?)$" {
      resolver 127.0.0.11;
      auth_request /verify/token;
      proxy_pass http://sites:3000/$1/charts/$3;
  }
  </code></pre>