我正在尝试动态调整远程图像的大小
location ~^/photo/thumb/ {
rewrite ^/photo/thumb/(\d+)x(\d+)/(.+)$ /photo/original/$3 break;
proxy_pass http://remote.url:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffer_size 512k;
proxy_buffers 16 512k;
image_filter resize $1 $2;
}
但返回的图像没有变化。我试图硬编码尺寸,但图像保持不变。我做错了什么?
答案 0 :(得分:1)
我做到了 - rewrite
是最大的问题,您需要proxy_pass
来确定网址。即这对我有用:
location ~^/photo/thumb/(\d+)x(\d+)/(.+)$ {
proxy_pass http://remote.url:80/photo/original/$3;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffer_size 512k;
proxy_buffers 16 512k;
image_filter resize $1 $2;
}