所以這似乎應該很容易...每個人都說只是使用config.asset_host
。當我設置,雖然,我的應用程序內的所有鏈接仍然指向S3。Cloudfront + Carrierwave
CarrierWave.configure do |config|
config.storage = :fog
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => AWS_ACCESS_KEY_ID,
:aws_secret_access_key => AWS_SECRET_ACCESS_KEY,
:region => 'us-east-1'
}
config.fog_authenticated_url_expiration = 3.hours
config.asset_host = "http://xyz123.cloudfront.net"
config.fog_directory = S3_BUCKET_NAME
config.fog_public = false
config.fog_attributes = {
'Cache-Control' => "max-age=#{1.year.to_i}"
}
end
這裏是我打電話給我的文件...
image_tag book.attachments.first.filename.file.authenticated_url(:thumb175)
它看起來對我來說,public_url
預先考慮適當的主機,但它需要0參數...所以我怎麼通過正確的response-content-disposition
和response-content-type
和鏈接到期時間?