Heroku Amazon S3 fileserver how to do routes?
How to do routes with Amazon S3 fileserver?
I have uploaded my photographer folder to Amazon S3.
My public dictory I had the folder:
photographer
And in photographer I had the folders:
flv
images
quicktime
I have uploaded开发者_如何学JAVA the photographer folder to Amazon S3.
How do I get Heroku to work with Amazon S3 and have the same routes as if the folder photographer was in the public directory?
I'm going to assume these files are static assets in which case you define an asset host as following in production.rb (and development.rb if you like):
config.action_controller.asset_host = "http://bucketname.s3.amazonaws.com/"
One way is to grab the parameters (which subfolder and the filename) from the request and then redirect the request to the corresponding S3 address. There is some good information on this in the redirection section at RailsGuides.
精彩评论