开发者

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

开发者 https://www.devze.com 2023-02-18 11:48 出处:网络
I am using the aws-s3 & paperclip gems to upload images from my Rails app. The images always get uploaded correctly, and 99% of the images can be viewed fine from my web-app.

I am using the aws-s3 & paperclip gems to upload images from my Rails app.

The images always get uploaded correctly, and 99% of the images can be viewed fine from my web-app.

But sometimes, an image won't load. If I paste the url into the brower, I get an error:

<Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied</Message>
    <RequestId>value_here</RequestId>
    − <HostId>
        value_here
    </Hos开发者_开发技巧tId>
</Error>

I don't know why this is happening, as the same code is being used to upload every image.

When I go to the AWS console I can open the image from there fine. I can't see anything different with the images that don't work. Here's a screenshot of the permissions of one of the images that doesn't work, from what I can tell they're the same as the other images:

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

What is causing this problem?

Edit:

Some more detail. You can upload an image 2 ways in my app, either by file upload or by providing an image URL. Both methods work fine 99% of the time.

I get the access denied error everytime I try to upload this file by providing the url:

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

If I save the image to my computer, and do a file upload, it works fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消