The answer to the question is YES. The reason why it didn't work with my configuration is that I was missing the fog_directory
entry. When I added my asset_host
, I removed fog_directory
since the CDN urls being generated where malformed. I later found out that this was due to having fog_public
set to false. After getting the proper CDN urls, I forgot to add fog_directory
back since I could see my images and thought everything was fine. Anyway the correct configuration is:
CarrierWave.configure do |config|
config.storage = :fog
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => ENV['S3_ACCESS_KEY_ID'], # required
:aws_secret_access_key => ENV['S3_SECRET_ACCESS_KEY'], # required
:region => 'eu-west-1'
}
config.fog_directory = '-bucket-name-/-some-folder-'
config.asset_host = 'https://static.my-domain.com/-some-folder-'
config.fog_public = true # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
end