rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: yuuko008 on September 01, 2009, 03:29:49 PM

Title: Referrer?
Post by: yuuko008 on September 01, 2009, 03:29:49 PM
I want to ask if this is possible.
As you can see i am placing the download links from my server to my site, which means on different pages example.

http://mydomain.com
http://mydomain.com/topic
http://mydomain.com/topictopic

Is there a way that HFS will look if "mydomain.com" is in the url then allow the download?
Title: Re: Referrer?
Post by: bacter on September 01, 2009, 05:45:45 PM
you can use the following macro in your template:

{.if |{.pos|mydomain.com|{.header|host.}.}|{: .... do something or set a variable you use later ....   :}.}

This might be useful, if you want to generate different pages depending what url is used to access your server, for example if you have more than one domain names, or if you want to distingush users from wan or from lan.

But if you publish or mail a full valid downloadlink (for example: http: // mydomain.com/topic/filename.ext) then the download request will be executed directly and the only way to avoid access is protecting your server with user access rights.
Title: Re: Referrer?
Post by: yuuko008 on September 01, 2009, 11:27:23 PM
i'm not really sure what to place i'm a real newbie in terms of coding.
Can you spoonfeed me for a little? I mean what is the exact code i need to place? And what will i place in this part
|{Set up variable for later use.........}
Title: Re: Referrer?
Post by: bacter on September 01, 2009, 11:49:49 PM
I can only answer your question, that's what i have done.

1) there is a way to know if something is part of the request in the header and you can use this property in your template.

2) if you give a link to a file, the file will be downloaded (if access is not protected!) and you can't avoid it as a download request does not pass through the template.

I can not help you with 'exact code' as i don't know what you want to do or not to do...
Title: Re: Referrer?
Post by: yuuko008 on September 02, 2009, 12:03:10 AM
ahh ok so if i give the exact link to the file. Example. http://HFS-IP/File.ext then i cannot protect it anymore?
Title: Re: Referrer?
Post by: maverick on September 02, 2009, 12:21:17 AM
Is there a way that HFS will look if "mydomain.com" is in the url then allow the download?

This is maybe what you are looking for...

1. Switch HFS to Expert Mode
2. Select Menu -> Limits -> Allowed referer

Here you can specify a mask.  When a file is requested and the mask doesn't match the Referer Http field, the request is rejected.  If the mask matches then the download is allowed.
Title: Re: Referrer?
Post by: rejetto on September 04, 2009, 02:56:05 PM
yes, that the option he is searching for.

you should enter *mydomain*
in that dialog