0

I am trying to understand what needs to be done to initiate a download of files that are housed on a server different from the one on which the Rails app is?

Specifically, my Rails app is on Heroku and the PDFs I want to make available for download are on Linode. I would like the client to get the PDFs when he/she clicks on a download button in the web-app

My first attempt was with send_file :type => 'application.pdf', :x_sendfile => true. But this is obviously wrong because it can only serve files stored locally on the web-app server

  1. Is there, therefore, a way to get Linode to send data directly to the client? , OR
  2. Do I have to download the file locally and then call send_file ? (yuck!!!)
  3. Would any changes be required on the Linode end? I have a web-service running there on Tomcat

Thanks in advance for your help, Abhinav

Abhinav
  • 203
  • 2
  • 9

1 Answers1

0

You can try reading the file into a data stream and using send_data. Here is a Ruby forum discussion of a similar idea. The post also describes your yuck options (#2, local download). Unfortunately I cannot speak to Linode changes.

Also, here is an SO post about a similar issue.

Community
  • 1
  • 1
ScottJShea
  • 7,041
  • 11
  • 44
  • 67