jeudi 1 octobre 2015

Getting Negative Expiry when Using Fog AWS S3 & Rails

I'm attempting to generate a signed url for a file in S3 using Fog; however, the url that get's returned always returns a negative expiry which causes the url to 400.

connection = Fog::Storage.new(
  region: 'us-west-1',
  provider: 'AWS',
  aws_access_key_id: ENV['AWS_ACCESS_KEY'],
  aws_secret_access_key: ENV['AWS_SECRET_KEY']
)
bucket = connection.directories.get(BUCKET)
file = 'test.jpg'
p file_url = bucket.files.get_https_url("uploads/#{file}", 300)

Generated URL:

http://ift.tt/1O5WP3f
-Amz-SignedHeaders=host&X-Amz-Signature=e31663f9b2470e***215825d585b14c37e

Am I missing something here? Why is the generated url giving me a negative expiration (X-Amz-Expires)?




Aucun commentaire:

Enregistrer un commentaire