RoR send_file not working on Apache
I have Rails 3 running on an Apache web server on Slicehost and was using send_file() for Boply after someone made a file purchase. The problem was it would successfully email the file to the purchaser but if they clicked in their browser to download it was sending an 0 byte file. And of course "it works on my local machine." The problem as it turns out is that Rails 3 added a new configuration property to production.rb.
Namely this one: config.action_dispatch.x_sendfile_header = "X-Sendfile".
This configuration property leverages Apache to stream the file to the user's machien rather than letting Rails do it. But the problem I was facing was that I did not have the mod_xsendfile module enabled in Apache so it wasn't working.
