How can i get image from another site with nginx for resizing?

Viewed 21

Hellow! I have site http://example.com with api /image

And i have some imagestore on http://myimagestore.com/my/image/1.jpg

I need to get image from imagestore when anybody call http://example.com/image

it easy configurated by ngixng like that:

location = /image {
         rewrite ^ http://myimagestore.com/my/image/1.jpg;
    }

But now i need resize this image.

For that i'm trying to work with http://nginx.org/ru/docs/http/ngx_http_image_filter_module.html like that:

location = /image {
    if ($arg_filter = "x200_180") {
        error_page 418 = @resize_200_180;
        return 418;
    }
}

location @resize_200_180 {
    image_filter resize 270 -;
    image_filter_buffer 20M;
    image_filter_jpeg_quality 75;
    rewrite ^ http://myimagestore.com/my/image/1.jpg;
}

But rewrite return 30X with Localion header and image_filter resize can't work with it and return 415. It needs 200 with real content from http://myimagestore.com/my/image/1.jpg

How can i get it withiut getting real content in the backend of my api?

Thanks for your attention.

0 Answers
Related