Issue with image resizing
Benyamin Dvoskin
benyamin.dvoskin at gmail.com
Mon Feb 6 16:00:03 UTC 2017
Hi,
I'm trying to implement live image resizing on nginx using
ngx_http_image_filter_module, and I get some weird issues with it.
this is my config for resizing:
server {
listen 1111;
server_name localhost;
set $backend 'bucket.s3.amazonaws.com';
resolver 8.8.8.8;
resolver_timeout 5s;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass_request_body off;
proxy_pass_request_headers off;
proxy_hide_header "x-amz-id-2";
proxy_hide_header "x-amz-request-id";
proxy_hide_header "x-amz-storage-class";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Set-Cookie";
proxy_set_header Host $backend;
proxy_method GET;
image_filter_interlace on;
location ~ \/(?<producttitle>.+?)\/(?<image>.+?)-W(?<width>(\d+)).(?<ext>[a-z_]*)
{
image_filter resize $width -;
proxy_pass http://$backend/$producttitle/$image.$ext;
error_page 415 = /empty;
}
location = /empty {
empty_gif;
}
}
and this is my config for caching:
server {
listen 80;
server_name images.domain.com;
location ~ \/(?<producttitle>.+?)\/(?<image>.+?)-W(?<width>(\d+)).(?<ext>[a-z_]*)
{
proxy_pass http://localhost:1111;
proxy_cache mc_images_cache;
proxy_cache_key "$host$document_uri$image$width";
proxy_cache_lock on;
proxy_cache_valid 200 30d;
proxy_cache_valid any 15s;
proxy_cache_use_stale error timeout invalid_header updating;
proxy_http_version 1.1;
expires 30d;
}
}
the issue I'm experiencing is getting 415 errors out of no where for some
of the width values I provide in the URL.
sometimes they work and sometimes I get 415.
nothing informative in debug log.
any idea what I'm doing wrong here?
--
Thanks,
Benyamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170206/3fad9e5d/attachment.html>
More information about the nginx
mailing list