Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set path_style for S3 bucket name with dots #239

Closed
wants to merge 2 commits into from

Conversation

dlackty
Copy link

@dlackty dlackty commented Dec 13, 2013

Recently I updated my fog bundled version and got errors when syncing assets. After digging to the codes, I found several discussions about S3 bucket name with dots included. Ref: fog/fog#2381

Adding :path_style= > true for fog_options when fog_directory contains dots would fix this issue.

This pul request closes #237.

@dallas
Copy link

dallas commented Feb 20, 2014

+1 on this

Not sure if this is only AWS specific or if other providers have the same issue and configuration option, but I ended up just doing a simple override of the fog_options method in a config/initializers/asset_sync_overrides.rb file in my Rails app:

module AssetSync
  class Config
    alias_method :original_fog_options, :fog_options

    def fog_options
      options = original_fog_options
      options.merge!(path_style: true) if aws? && fog_directory =~ /\./
      options
    end
  end
end

@dlackty
Copy link
Author

dlackty commented Mar 1, 2014

@davidjrice any opinion for this pull request? I believed it's helpful for some users.

@josacar
Copy link
Contributor

josacar commented May 8, 2014

What are the disadvantages of setting path to true ?

AFAIK, Fog crashes if there's any bucket with dots when trying to list all of them, so adding a guard to check the configured bucket is not a proper solution.

It would be nice to have this fixed by defaulting this or just adding a configuration option.

@dlackty
Copy link
Author

dlackty commented Aug 19, 2014

Hey @tosbourn, any chance to get this merged? I rebased the master changes, and also passed CI.

barodeur added a commit to 34be/asset_sync that referenced this pull request Aug 21, 2014
Set path_style for S3 bucket name with dots

* dlackty/path-style:
  Add spec for path_style config
  Use path_style for dots included bucket
@slaskis
Copy link

slaskis commented Oct 6, 2014

I am unable currently to deploy to heroku because of this issue. I keep getting this error:

Excon::Errors::SocketError: hostname "assets.x.com.s3.amazonaws.com" does not match the server certificate (OpenSSL::SSL::SSLError)

@dlackty
Copy link
Author

dlackty commented Oct 7, 2014

@slaskis You can temporarily workaround this issue by changing your Gemfile:

gem "asset_sync", github: "dlackty/asset_sync", branch: "path-style"

@slaskis
Copy link

slaskis commented Oct 7, 2014

Thanks @dlackty! I actually went with another workaround, by setting Fog.credentials = { path_style: true } in my asset_sync.rb initializer.

@dlackty
Copy link
Author

dlackty commented Feb 7, 2017

closed in favor of #302

@dlackty dlackty closed this Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bucket name with period just hangs
4 participants