You can use the built-in rails send_file or send_data .
To transfer the file (for example, for the endpoint of the file proxy), use send_file:
send_file("#{RAILS_ROOT}/path/to/file/on/server",
:filename => "client-suggested-filename",
:type => "mime/type")
For streaming data generation (for example, for generated PDF) use send_data:
send_data(your_data,
:filename => "client-suggested-filename",
:type => "mime/type")
mime , , , . , mime application/pdf, :filename something.pdf.
, mime , wikipedia mime-types gem. (, , mime, ).