有没有一种方法可以在不下载并存储在本地的情况下用nginx代理外部图像?即,将图像的URI
传递给我的代理服务器,如下所示:
`http://myproxydomain.com/http://example.com/image.jpg`
并将此URI
包含在我的站点上的图像的src
属性中。
是——这是可能的:
merge_slashes off;
location ~ /(?<r>http://.*) {
resolver 127.0.0.1;
proxy_pass $r;
}
你是否应该这样做是另一回事。拥有merge_slashes off
可能不是一个好主意。