Sporadically, images uploaded to S3 with aws-s3 and paperclip gems have an AccessDenied error when trying to view them. 99% work fine?

I use aws-s3 and paperclip to load images from my Rails application.

Images always load correctly, and 99% of the images can be viewed in my web application.

But sometimes the image does not load. If I embed url in brower, I get an error:

<Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied</Message>
    <RequestId>value_here</RequestId><HostId>
        value_here
    </HostId>
</Error>

I do not know why this is happening, since the same code is used to load each image.

When I switch to the AWS console, I can open the image from there. I do not see anything else with images that do not work. Here's a screenshot with the resolutions of one of the images that don't work, from what I can say, they are the same as the other images:

enter image description here

What causes this problem?

Edit:

A few more details. You can upload an image in two ways in my application, either by uploading a file or by providing an image URL. Both methods work fine in 99% of cases.

I get an access denied error every time I try to download this file by specifying url:

http://www.quadrant.org.au/img/content/Jan%20Feb%202011/True%20Grit.jpg

If I save the image on my computer and download the file, it works fine.

+3
source share

All Articles