| Author |
|
Dre240 Newbie

Joined: 14 August 2008 Location: Canada
Online Status: Offline Posts: 7
|
| Posted: 18 August 2008 at 6:54pm | IP Logged
|
|
|
Hello I was wondering if someone could help me to write a regular expression to use with Hotlinkblocker and its REFERER Protection Type.
I am trying to block external access to all filetypes except for php, htm, and html files
Currently I'm using a bunch of seperate rules for each file type that i'm protecting such as this one for PDF files:
@.*\.pdf
I would like to create one rule which will do the opposite, and instead of creating a rule for each file to protect, I would like one rule to protect every file except .php, .htm, and .html files.
Any help would be greatly appreciated.
Thanks
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Online Posts: 4837
|
| Posted: 26 August 2008 at 9:28am | IP Logged
|
|
|
Please try to utilize the following line:
REFERER @(?!.*\.(?:php|html?)).* http://www.mysite.com/leech.htm
__________________ Regards,
Anton
|
| Back to Top |
|
| |
Dre240 Newbie

Joined: 14 August 2008 Location: Canada
Online Status: Offline Posts: 7
|
| Posted: 26 August 2008 at 1:21pm | IP Logged
|
|
|
It works, thanks so much.
However I have one more problem which hopefully you could help me with.
When ever hotlinkblocker is enabled, whether i'm using my original rule, or the rule you just gave me, or even if i just do: referer / i get a problem that the server won't serve files larger than 500KB.
If i click on a link one my site for a pdf file thats under 500kb, it will open up properly, and if i try to goto that link directly, it will be blocked and sent back to login page as it should.
If i try to click on a link on my site for a pdf file thats larger than 500kb, it will open up and u can see it starts to download the file and then it just stops at arround 500KB.
I enabled logging on the server to find out what going on here, because when i disable hotlinkblocker all files can be serverd okay no matter there size. Here is what the log file shows:
#Software: Microsoft Internet Information Services 6.0 #Version: 1.0 #Date: 2008-08-26 17:33:39 #Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken 2008-08-26 17:34:34 W3SVC760666179 TESTBOX 192.168.4.252 GET /ppmanual/Part1-AppendixC1-EN-Resolution-April1985.pdf - 80 - 192.168.4.122 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.2) googleCookie=googlemini;+PHPSESSID=q79hihioapi81bdvk29khsgo66 http://mysite.site.com/english/policies_1.php mysite.site.com 200 0 22 327940 556 1015 2008-08-26 17:34:34 W3SVC760666179 TESTBOX 192.168.4.252 GET /ppmanual/Part1-AppendixC1-EN-Resolution-April1985.pdf - 80 - 192.168.4.122 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.2) googleCookie=googlemini;+PHPSESSID=q79hihioapi81bdvk29khsgo66 - mysite.site.com 302 0 0 375 433 0 2008-08-26 17:34:34 W3SVC760666179 TESTBOX 192.168.4.252 GET /login.php - 80 - 192.168.4.122 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+InfoPath.2) googleCookie=googlemini;+PHPSESSID=q79hihioapi81bdvk29khsgo66 - mysite.site.com 200 0 0 6732 389 15
It appears to me that when I try to click on a link for a large file its some how splitting the file up instead of sending it all at once, and the second connection for the remainder of the file doesnt not have the referer info in it, so it is then blocked and hotlinkblocker tries to redirect it to the login page.
I have been trying to figure out a way to resolve this, but so far I have been unsuccessfull.
Someone was suggesting that this may be an IE7 issue, so tried to access the same links for the PDF files which are larger than 500kb through firefox and all it shows is "File does not begin with '%PDF-'.
Your help would be greatly appreciated.
Thanks
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Online Posts: 4837
|
| Posted: 27 August 2008 at 7:11am | IP Logged
|
|
|
Can you please send your live link (to see the problem online) to support@helicontech.com And please specify the link to forum topic.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
Dre240 Newbie

Joined: 14 August 2008 Location: Canada
Online Status: Offline Posts: 7
|
| Posted: 27 August 2008 at 7:46pm | IP Logged
|
|
|
Hey Anton,
I was not able to grant access to my actual site due to security reasons, so I have created a test site which replicates the exact setup of my site and the same problem can also be seen happening on this test site. I have put a bunch of links to different size PDF files on the test site, and if you try to access any of the larger ones with IE you will see that they halt during download, and with Firefox you just get an error. I have also put a link on the page which give you direct access to the log file for the test site so you can see whats going on in real time.
The site currently has the following rule which you gave me before enabled with hotlinkblocker:
REFERER @(?!.*\.(?:php|html?)).* http://www.mysite.com/leech.htm
I sent the email to support@helicontech.com on Wednesday, August 27, 2008 at 8:18 PM with the following subject "Hotlinkblocker Problem - Livelink Request by Moderator"
Hopefully you guys can figure out a way to resolve this.
Thanks for all your help!
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Online Posts: 4837
|
| Posted: 28 August 2008 at 4:50am | IP Logged
|
|
|
Actually REFERER method does not work with pdf files (it is destined only for images), so please try using REDIRECT method:
REDIRECT @(?!.*\.(?:php|html?)).* http://www.mysite.com/leech.htm
__________________ Regards,
Anton
|
| Back to Top |
|
| |
Dre240 Newbie

Joined: 14 August 2008 Location: Canada
Online Status: Offline Posts: 7
|
| Posted: 28 August 2008 at 7:48pm | IP Logged
|
|
|
Thank you, that works very well.
I didn't even think of using the redirect method.
Thank you for all your help.
|
| Back to Top |
|
| |