我想要的
我正在尝试为类设置背景图片,图片存储在Amazon S3上,我通过Rails上的Paperclip对象访问图片。
CSS类
.user-area{
background-image:url('<%=@user.background_image.expiring_url %>');
background-repeat:no-repeat;
width:1025px !important;
margin-top:100px !important;
}
在浏览器上输出
.user-area{
background-image:url('https://xyz-customers.s3.amazonaws.com/photos/7/superbackground.jpg?AWSAccessKeyId=xxxxxxxxxxxxx&Expires=1402511741&Signature=xxxxxxxxxxxxxxxx');
background-repeat:no-repeat;
width:1025px !important;
margin-top:100px !important;
}
问题
图片在浏览器上不可见,但当我访问Amazon S3 URL(由CSS类生成)时,我可以查看图片。
浏览器还为此文件抛出403错误:Failed to load resource: the server responded with a status of 403 (Forbidden)