Downloading image on client side is giving CORS Error

I have couple variants, one for thumbnail and other one is full sized image. On client side, I am showing thumbnail using <img src=$thumbnailUrl> tag and there’s an option to download full sized image using <a download href="$fullSizeUrl">. Download is giving CORS error client side.

One way to solve this could be to pass this image through a proxy which adds CORS headers. Any better suggestions on how to go about solving this?

2 Likes

I have the same issue and look forward to a suggestion. My work-around is to download the original file from a storage bucket, perhaps R2 will support this when it is available. Another option is to open the full size image in a new browser window and prompt the user to save it, but they will have to allow popups.

Yeah, no good workarounds I could think of. I have made a worker script which downloads and adds CORS headers.

I had this issue as well. I am putting the image onto a canvas. I can do that via an image element, but it makes the canvas untrusted. It would be nice to be able to set allowed domains in the dashboard.

This topic was automatically closed after 15 days. New replies are no longer allowed.