Hi, i've servers (not connected directly, only by internet), one with a
rails app, and another with the big static files. The problem is, to
access to one of them file you have to be logged, and when you click on
a link the rails app will send you the file, but using the other server.
Something like a redirect to download a file, but the real url of the
file shouldn't be displayed.
Simple example:
I'm the user, i go to the site. I try to insert the url like
domain.com/download/3 and the rails app tell me that i have to login, i
login, i try another time and the app send me the file xyz.zip. Now,
because i'm curious i do a properties on the current download to show
where the file is stored, and i see domain.com/download/3, and not the
real one which would be domain2.com/files/xyz.com
What do you think? Is it possible ? There is send_file, but iirc it's
just for local files.
Thanks
The browser has to know where to get the file from or else it can't get it. I don't think you can do this if the 2 servers are distinct (and don't have any shared storage) unless you do something horrible like download it from the second server & forward it on byte by byte.
I’ve just recently done something like this, without the having to log in.
I’ve created a downloads controller and a download model, the download model keeps track of what files are assigned to what IP and the users have to use the generated URL to get to their download. The cool thing is that it will not show the name of the file.
I’m using xsendfile to do this and going through apache. Another great thing is that, unlike send_file, this won’t tie up a Rails request. Very handy if you’re downloading large files.
I've just recently done something like this, without the having to
log in.
I've created a downloads controller and a download model, the
download model keeps track of what files are assigned to what IP and
the users have to use the generated URL to get to their download.
The cool thing is that it will not show the name of the file.
I'm using xsendfile to do this and going through apache. Another
great thing is that, unlike send_file, this won't tie up a Rails
request. Very handy if you're downloading large files.
The problem as i understand it is that the server with the files and
the server with the rails app are physically distinct, so send_file
XSendfile doesn't help.
The problem as i understand it is that the server with the files and
the server with the rails app are physically distinct, so send_file
XSendfile doesn't help.
right, the server aren't even in the same data center. i'll hope in the
future to move everything in the same one so i'll use xsendfile
Thanks anyway