Reputation: 13581
I want to use fog_authenticated_url_expiration
def fog_public
false
end
It works great, however because of S3's issue with subdomains and dots (.) in bucket names. My path has SSL warnings and I can't change the bucket name to be otherwise to keep my routes working correctly.
Amazon S3 - HTTPS/SSL - Is it possible?
The default carrierwave path for authenticated urls produces SSL warnings because of the subdomain:
https://subdomain.domain.com.s3-eu-west-1.amazonaws.com/uploads/quiz/131/question_sheet/Q286.pdf?AWSAccessKeyId=AKIAJKOSTQ6UXXLEWIUQ&Signature=xdHUEiNjEZxftVxr5rw7uHaMmwk%3D&Expires=1387662760
Whereas this formula would work fine:
https://s3-eu-west-1.amazonaws.com/subdomain.domain.com/uploads/quiz/131/question_sheet/Q286.pdf?AWSAccessKeyId=AKIAJKOSTQ6UXXLEWIUQ&Signature=xdHUEiNjEZxftVxr5rw7uHaMmwk%3D&Expires=1387662760
How can I override the path style in carrierwave to use the second one to avoid SSL issues?
Upvotes: 1
Views: 798
Reputation: 1779
I ran into this myself and there is now a work around if you're using a recent version of carrier wave using path_style when setting the fog_credentials.
See this post here:
https://github.com/carrierwaveuploader/carrierwave/issues/1076
But this should solve it.
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', path_style: true
}
config.fog_directory = 'subdomain.domain.com' # required
config.asset_host = 'https://subdomain.domain.com' # optional, defaults to nil
config.fog_public = true # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
end
Upvotes: 1