title: nginx proxy forward headers of proxied server
body: <p>In my nginx caching proxy I use proxy_pass to redirect from location /file.js to <a href="http://somedomain.com/file.js" rel="nofollow noreferrer">http://somedomain.com/file.js</a>, and sub_filter to modify content of source file.js. How can I forward headers from <a href="http://somedomain.com/file.js" rel="nofollow noreferrer">http://somedomain.com/file.js</a>?</p>
  
  <pre><code>location /file.js {
      proxy_pass http://somedomain.com;
      sub_filter "subject" "replacement";
      sub_filter_types "text/javascript";
      sub_filter_once off;
      proxy_set_header Accept-Encoding "";
      proxy_pass_header Server;
  }
  </code></pre>
  
  <p>How can I get last-modified header from original file.js?</p>