I've got an app serving images on the filesystem from outside the /public directory so I can authenticate users first. I'm serving the images and thumbnails up using send_file, (1 large 60k image and 9 6k thumbnails) in one view, and it seems a bit sluggish. Is this just because of my crappy old windows box running in development mode - or is each request to serve up an image from an action in the controller slowing the app down?
on 2007-03-13 11:39
on 2007-03-14 05:50
Action caching will help improve matters, but if you need to authenticate for every image, you are already in a bad place for performance. Lighttpd and I'm sure other servers have a way of serving 'secure' downloads. This works by putting a token into the URL for each image when you generate the HTML. This token will expire shortly, so only that user will be able to read those images. The images are then served directly by the web server (but only if the token is valid). I've seen this technique used for downloading purchased MP3 files, and it worked as advertised. More info (including a Rails example) at the mod_secdownload page: http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload On Mar 13, 3:39 am, Robbie Shepherd <rails-mailing-l...@andreas-s.net>
on 2007-03-14 06:18
thanks Tom - after some more research it appears that Mongrel (which I'm using) seems to be playing a large part in the problem. I read about using lighttpd and the X-send-file header, which might work better.
on 2007-03-14 06:28
I have a plugin that extends Rails Action Caching to use the X- Sendfile header on lighttpd or the equivalent on nginx to send the cached file, so your Rails code only needs to care about action caching, and all the magic will be enabled by the server configuration. More info here: http://agilewebdevelopment.com/plugins/action_cache On Mar 13, 10:18 pm, Robbie Shepherd <rails-mailing-l...@andreas-
on 2007-03-14 08:25
There's a gem that is supposed to take care of this on Mongrel, although I haven't tried it. We're about to tackle the same issue so if you use this and it works for you would you mind dropping us a line? http://rubyforge.org/projects/msend-file/ Dale On Mar 13, 9:18 pm, Robbie Shepherd <rails-mailing-l...@andreas-s.net>