我正在使用带有carrierwave
和sitemap_generator
的Rails 3.2。
文件已正确上传,但S3上的权限不公开。
我的S3 Bucket通常只对令牌开放:
CarrierWave.configure do |config|
config.storage = :fog
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => ENV['S3_KEY'],
:aws_secret_access_key => ENV['S3_SECRET']
}
config.fog_directory = ENV['S3_BUCKET_NAME']
# -> THIS is what sitemap_generator likes:
# -> config.permissions = "0666"
# here I set my permissions:
config.fog_public = false
config.fog_attributes = {'Cache-Control' => 'max-age=315576000'}
end
我的sitemap_generator gem initalizer是:
# WaveAdapter: carrierwave
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
SitemapGenerator::Sitemap.sitemaps_host = "http://s3.amazonaws.com/#{ENV['S3_BUCKET_NAME']}/"
SitemapGenerator::Sitemap.public_path = 'tmp/'
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
谢谢!
答案 0 :(得分:0)
看起来config.fog_public设置为false;您应该将其设置为true以在S3上启用公共查看。