Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Rails Send_File in Production Delivers an Empty File


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

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 w/ #gotchas #mishaps #production #rails #send_fileruby on rails