image_filter on error_page location
Reinis Rozitis
r at roze.lv
Tue Jan 3 17:18:45 UTC 2012
Hello,
I can't figure how to solve such issue - nginx seems not to apply image_filter in case the picture comes from upstream via internal
error_page.
I have something like (if picture is prefixed with sm_ a dynamic thumbnail is made and the original saved locally):
location ~ /sm_ {
rewrite (.*)/sm_(.*) $1/$2 break;
image_filter crop 100 100;
error_page 404 = @store;
}
location @store {
internal;
proxy_pass http://backend/$uri;
proxy_store on;
}
If the file doesn't exist on the server client gets the original/full sized image, on the second request when the file is stored on
the nginx box the image/response gets resized.
Also requesting directly from the upstream within the location block:
location ~ /sm_ {
rewrite (.*)/sm_(.*) $1/$2 break;
image_filter crop 100 100;
proxy_pass http://backend/$uri;
}
works as expected but in this case obviously no local copy (which is necessary) is made.
Any suggestions?
wbr
rr
More information about the nginx
mailing list