This is not necessarily a FW question, but might be done in FW, also.
Can you hide the path from where a link is coming from? For instance, we have a client that wants to link to a file on our server, but doesn’t want it to look like it’s coming from our server.
Hi Bob,
There are scripts available that will move files on the server so that
download links aren’t exposed to end users. I use one on FreewayActions.com for the commercial action downloads and files are
copied to a holding spot before they are downloaded and then cleaned
away.
I would suggest looking at link obfuscation with the easiest method
using a service like TinyURL - http://tinyurl.com/
Regards,
Tim.
On 10 Jun 2010, at 22:24, Robert B wrote:
This is not necessarily a FW question, but might be done in FW, also.
Can you hide the path from where a link is coming from? For
instance, we have a client that wants to link to a file on our
server, but doesn’t want it to look like it’s coming from our server.
TinyURL will resolve to the real URL, though, so in the end the files will appear to come from your site. If you wanted to do this with a proxy application, that would sit on your client’s site, and the files would appear to come from the client’s site. Here’s the world’s smallest proxy, written in PHP5:
<?php
//requires URL stream wrappers on your server, pretty common
$file = file_get_contents('http://your.server.here/path/to/file.zip');
header('Content-type: application/zip');
header('Content-length: ' . strlen($file) );
print $file;
?>
Your client puts this on their server, links to it as if it were the file itself, and the file is requested from your server by your client’s server, and then forwarded on to the browser.
What this will not do is serve a Web page, because it will make a mess of all the links in the page and all the image references. A much more detailed proxy would rewrite all the links to the images and elsewhere so that they also appeared to be coming from your client’s server, keeping up the whole house of lies so the illusion is complete.
If you could make an example with exact urls, I could help better. “our client’s site is at xyz.com, and they want to add abc.com/folder/file.zip to their site as if it was on their own server” – that’s the level of detail I need here.
This is not necessarily a FW question, but might be done in FW, also.
Can you hide the path from where a link is coming from? For
instance, we have a client that wants to link to a file on our
server, but doesn’t want it to look like it’s coming from our server.
It doesn’t have to be exact, I just need to understand what type of content you are linking to from the client’s site, and where in the world (relative to the client’s site) that content actually lives. Here’s a fake example:
My site is http://example.com and client wants to be able to post a link to http://example.com/path/to/file.zip while hiding the fact that this link goes to to big bad .com world from within the fluffy unicorn .org world.
Client adds a file called download.php to their site, which contains the proxy code as follows:
I believe that’s enough to make the file appear on the visitor’s desktop. There’s a handful of other headers you can set in a proxy to make the file download a certainty, but you can probably get by with just these.
Now if you wanted to show an image from another site on your site while obscuring where exactly you got it from, that would be a different set of headers.
So a simple explanation – even in broad terms like this – of what you’re linking to and where it’s coming from makes it easier to show you a good working example.
Then the only changes you would need to make would be to the filename and the content-type header. PDF should be application/pdf. This should just work.
Note that this particular set of headers will force the download (or should). If you want to leave the choice to the user / browser, then you want to change the content-disposition from attachment to inline. Leave everything else alone.