Welcome! Log In Create A New Profile

Advanced

Issue with image resizing

Benyamin Dvoskin
February 10, 2017 11:32AM
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
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Issue with image resizing

Benyamin Dvoskin February 10, 2017 11:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 257
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready