send_file can also be used for a remote URL.
file = open("http://cdn2.example.com/somefile.pdf") send_file(file, :filename => "example.pdf", :type => "application/pdf" , :disposition => "attachment")
Here example.pdf will be downloaded. If you want to open pdf in the browser itself, use this
file = open("http://cdn2.example.com/somefile.pdf") send_file(file, :filename => "example.pdf", :type => "application/pdf" , :disposition => "inline")
source share