title: Set proxy header from upstream
body: <p>I'm configuring an application that will authenticate a user, and then set the <code>X-Accel-Redirect</code> header and a private api key, <code>Foo</code> (for testing purposes), that will be passed on to the proxied endpoint.</p>
  
  <p>I'm setting the private api key as a header in the authenticating application, and have the following location block in my nginx configuration file. How do I set the header to the proxied application based on what the upsteam server sets? I've also tried using <code>$http_foo</code> and <code>$sent_http_foo</code>. Currently, the Foo response header is never set for the proxy.</p>
  
  <pre><code>location ~* ^/redirect {
    internal;
  
    resolver 8.8.8.8;
    proxy_ssl_server_name on;
    add_header Foo $upstream_http_foo;
  
    set $my_host "requestb.in";
    set $my_uri "a_test_uri";
    proxy_pass http://$my_host/$my_uri;
  }
  </code></pre>