图像服务器的Nginx反向代理仅返回html标头

时间:2017-05-10 16:30:45

标签: nginx reverse-proxy

我使用Nginx为图像服务器执行反向代理。 (我是Nginx新手)。

要从原始服务器获取图像,我们需要传递一个令牌,以便原始网址看起来像这样

http://www.myphoto.com/htm/GetDocumentAPI.aspx?F=TRX&DocID=15-551703&token=726gxJexU69LsQplDw@a.gIyDnVTtd0@LbcGe47Ku4 *

和响应标题

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"

我的Nginx服务器:

location ~ ^/big/(.+) {
 proxy_pass http://www.myphoto.com/$1;
}

当我尝试从我的服务器获取图像时

http://localhost/big/htm/GetDocumentAPI.aspx?F=TRX&DocID=15-551703&token=726gxJexU69LsQplDw@a.gIyDnVTtd0@LbcGe47Ku4 *

而不是我得到的图像:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

和回复:

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

更改内容类型也不起作用

0 个答案:

没有答案