Written by Sean Behan on Sun Jun 17th 2012

If you're running Rails in production it will by default be configured to let apache or nginx send files for you. If you're handling file downloads yourself with send_file

send_file("path/to/file.txt")
you will notice that the downloaded files are empty. To get around this just comment out the following in your config/environments/production.rb file.
  # comment out for production because apache/nginx are not doing this for us
  #config.action_dispatch.x_sendfile_header = "X-Sendfile"

Tagged with..
#gotchas #mishaps #production #Rails #send_file #Ruby on Rails

Just finishing up brewing up some fresh ground comments...