title: Nginx reverse proxy for image server returns only html header
body: <p>I use Nginx to do reverse proxy for image server. (I am Nginx newbie).</p>
  
  <p>To get the image from the original server we need to pass a token so the orignal url looks like this</p>
  
  <p><a href="http://www.myphoto.com/htm/GetDocumentAPI.aspx?F=TRX&amp;DocID=15-551703&amp;token=726gxJexU69LsQplDw@a.gIyDnVTtd0@LbcGe47Ku4" rel="nofollow noreferrer">http://www.myphoto.com/htm/GetDocumentAPI.aspx?F=TRX&amp;DocID=15-551703&amp;token=726gxJexU69LsQplDw@a.gIyDnVTtd0@LbcGe47Ku4</a>*</p>
  
  <p>and the response headers</p>
  
  <pre><code>Cache-Control →private
  Content-Length →2653278
  Content-Type →image/jpeg; charset=utf-8
  Date →Wed, 10 May 2017 16:20:29 GMT
  Server →Microsoft-IIS/8.0
  X-AspNet-Version →4.0.30319
  X-Powered-By →ASP.NET
  content-disposition →inline;filename="15-551703.jpg"
  </code></pre>
  
  <p>My Nginx server:</p>
  
  <pre><code>location ~ ^/big/(.+) {
   proxy_pass http://www.myphoto.com/$1;
  }
  </code></pre>
  
  <p>When I try to get image from my server</p>
  
  <p><a href="http://localhost/big/htm/GetDocumentAPI.aspx?F=TRX&amp;DocID=15-551703&amp;token=726gxJexU69LsQplDw@a.gIyDnVTtd0@LbcGe47Ku4" rel="nofollow noreferrer">http://localhost/big/htm/GetDocumentAPI.aspx?F=TRX&amp;DocID=15-551703&amp;token=726gxJexU69LsQplDw@a.gIyDnVTtd0@LbcGe47Ku4</a>*</p>
  
  <p>Instead of the image I get:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  </code></pre>
  
  <p>and the response:</p>
  
  <pre><code>Cache-Control →private
  Connection →keep-alive
  Content-Encoding →gzip
  Content-Type →text/html; charset=utf-8
  Date →Wed, 10 May 2017 16:07:08 GMT
  Server →nginx/1.4.6 (Ubuntu)
  Transfer-Encoding →chunked
  X-AspNet-Version →4.0.30319
  X-Powered-By →ASP.NET
  </code></pre>
  
  <p>Changing the content type didn't work too</p>