imazen / imageflow

High-performance image manipulation for web servers. Includes imageflow_server, imageflow_tool, and libimageflow
https://docs.imageflow.io/
GNU Affero General Public License v3.0
4.14k stars 140 forks source link

Status 404 due to missing url param questionmark with permacache #584

Closed forgemo closed 2 years ago

forgemo commented 3 years ago

I tried to start the latest docker image imazen/imageflow_server_unsecured:latest with the following enrtypoint

entrypoint: '/bin/sh -c "sudo chown -R imageflow /home/imageflow/ && /home/imageflow/imageflow_server start --mount "/blog/:permacache_proxy_guess_content_types:https:://while.dev/img/" --bind-address 0.0.0.0 --port 3000 --data-dir /home/imageflow/data/"'

When trying to resize an image, I get a 404 response with the following rust logs.

imageflow_1  | [2021-04-13T21:55:51Z DEBUG hyper::client::pool] pooling idle connection for "https://while.dev"
imageflow_1  | [2021-04-13T21:55:51Z DEBUG reqwest::async_impl::response] Response: '404 Not Found' for https://while.dev/img0-null-undefined.pngw=109
imageflow_1  | [2021-04-13T21:55:51Z DEBUG tokio_reactor::registration] scheduling Read for: 0
imageflow_1  | [2021-04-13T21:55:51Z DEBUG tokio_reactor] dropping I/O source: 0
imageflow_1  | [2021-04-13T21:55:51Z INFO  logger] GET http://imageflow.while.dev/blog/0-null-undefined.png?w=109 404 Not Found (174.431188 ms)
imageflow_1  | [2021-04-13T21:55:51Z DEBUG hyper::server::response] writing head: Http11 NotFound
imageflow_1  | [2021-04-13T21:55:51Z DEBUG hyper::server::response] headers [
imageflow_1  |     Headers { Content-Type: text/plain
imageflow_1  |     , Content-Length: 58
imageflow_1  |     , Date: Tue, 13 Apr 2021 21:55:51 GMT
imageflow_1  |     , }]
imageflow_1  | [2021-04-13T21:55:51Z DEBUG hyper::server::response] write 58 bytes
imageflow_1  | [2021-04-13T21:55:56Z DEBUG hyper::server] ioerror in keepalive loop = Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }

I noticed in the logs, that the requested url by imageflow is missing the question mark for the url params.

https://while.dev/img0-null-undefined.pngw=109

I would expect it to be

https://while.dev/img0-null-undefined.png?w=109

or

https://while.dev/img0-null-undefined.png

I'm new to imageflow, but this seems like a bug to me.

When I use ir4_http instead of permacache_proxy_guess_content_types everything seems to work as expected.

When I use permacache_proxy I see the same behavior as with permacache_proxy_guess_content_types.

Disclaimer: I just started to work with imageflow and docs.imageflow.io is broken #583. Maybe I'm missing some relevant bits that would have been mentioned in the docs.

lilith commented 3 years ago

This does look like a bug. Are you expecting the proxy to do image processing though? it's just a pass through proxy (with a concatenation bug)

forgemo commented 3 years ago

I did indeed expect it to do image processing and cache the processed images, so that the image won't be processed again on the next request with the same params. Was this assumption wrong?

mpwsh commented 2 years ago

Sorry to raise an old issue. I'm doing some testings as well and would love some functionality like the one described above by @forgemo

The issue you are having is because permacache_proxy doesn't process the images using ImageResizer4 API.

When using ir4_http, images are saved locally to be processed, but then after the first download they are downloaded again and again after each request, instead of checking if the file is already present on disk and use that to run the processing (or at least it looks like its doing this).

lilith commented 2 years ago

We strongly suggest using Imageflow.NET Server instead of imageflow_server

On Sun, Feb 20, 2022, 1:04 PM mpw @.***> wrote:

Sorry to raise an old issue. I'm doing some testings as well and would love some functionality like the one described above by @forgemo https://github.com/forgemo

The issue you are having is because permacache_proxy doesn't process the images using ImageResizer4 API.

When using ir4_http, images are saved locally to be processed, but then after the first download they are downloaded again and again after each request, instead of checking if the file is already present on disk and use that to run the processing (or at least it looks like its doing this).

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow/issues/584#issuecomment-1046310612, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH22NR3DWWLLMSTGK6LU4FCOLANCNFSM424GCFYQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

lilith commented 2 years ago

https://github.com/imazen/imageflow/issues/598