#1 open
Rick

Fwd: attachment_fu and virtual hosting contribution

Reported by Rick | March 8th, 2007 @ 02:25 PM

Rick,

s3 has the ability to do "Virtual Hosting of Buckets". Instead of

urls such as :

s3.amazonaws.com/images/1/fu.jpg

you can use:

images.mysite.com/images/1/fu.jpg

As a requirement the bucket name has to be the same name as the full

domain so in the example above the bucket name is 'images.mysite.com'

Amazon's docs on this are here: http://docs.amazonwebservices.com/

AmazonS3/2006-03-01/VirtualHosting.html

To support this in attachment_fu, I added a 'virtual_host' entry in

amazon_s3.yml:

virtual_host: true

and patched s3_url:

module Backends

module S3Backend

def s3_url(thumbnail = nil)

if s3_config[:virtual_host]

File.join(s3_protocol + bucket_name + s3_port_string,

full_filename(thumbnail))

else

File.join(s3_protocol + s3_hostname + s3_port_string,

bucket_name, full_filename(thumbnail))

end

end

end

end

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages