Forum

Prevent hotlink

Kapageridis Stavros
26 November 2014, 18:08
Hi, i need to prevent the hotlinking of a script i host. The script is flash and the some users try to embed it to their site or blogspot. Is there any way to achieve the blocking of hotlink ?



Hiawatha version: 9.8
Operating System: Ubuntu 14.04 x64
Hugo Leisink
26 November 2014, 18:39
To protect a single file:
UrlToolkit {
ToolkitID = block_hotlink
Match !/script/my_flash Return
Header Referer !www.mydomain.com DenyAccess
}

VirtualHost {
...
UseToolkit = block_hotlink
}


To protect multiple files:
UrlToolkit {
ToolkitID = check_referer
Header Referer !www.mydomain.com DenyAccess
}

UrlToolkit {
ToolkitID = block_hotlink
Match /script/my_flash Call check_referer
Match /img/image.jpg Call check_referer
Match /js/script.js Call check_referer
...
}

VirtualHost {
...
UseToolkit = block_hotlink
}
Kapageridis Stavros
26 November 2014, 18:46
Thank you Hugo for the fast response.
Kapageridis Stavros
2 December 2014, 18:44
Hugo in this example the toolkit block the "!www.mydomain.com" to play the flash file or allow only this domain to play the my flash file ?
Hugo Leisink
2 December 2014, 19:24
I don't understand your question...
Kapageridis Stavros
2 December 2014, 19:34
The urltoolkit check_referer check's the referer heades to see if there is any domain that i deny to access my urltoolkit block_hotlink matches. Correct ?
If yes , there is needed me to add every domain name that tries to hotlink files from my domain. I wondering if there is a way to set the check_referer to ALLOW ONLY the domain i set at Header Referer and deny to any other.
Kapageridis Stavros
2 December 2014, 19:38
I try to make my question more simple, my english is too bad.
Header Referer !visichat.gr DenyAccess, mean's allow only visichat.gr and deny all others or the opposite ?
Hugo Leisink
2 December 2014, 19:45
The exclamation mark means 'not'. So, in your example, every referer that does NOT contain visichat.gr will be denied access.
Kapageridis Stavros
2 December 2014, 19:49
Thank you Hugo,
i set it like as the example but still allow the hotlinking from greekradioweb.blogspot.gr . I will try more to figure out what is going on.
Kapageridis Stavros
2 December 2014, 20:08
Done, i set to block the match of /chat/index.php.
Hugo Leisink
2 December 2014, 20:11
It's tricky to use the browser for testing, because of it's cache. Use a cmd tool like telnet for it and type your HTTP requests manually to do your testing.
This topic has been closed.