Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Does anyone have an idea of what's the impact on a website performances when activating Hotlink protection on server.

FYI: hotlink protection disallows other websites on other servers to place an image on their websites that directly refers to my websites. For instance let's say mywebsite.com is including an img file called test.jpg, anotherwebsite.com can NOT place in its pages this line:

<img src="http://mywebsite.com/test.jpg"> 

because mywebsite.com server would recognize that such request is not coming from mywebsite.com and stops the request, therefor anotherwebsite.com woudl display nothing in place of the image.

Actually my websites on which I activated Hotlink protection do not seem to run slower. But I'm just wondering waht's behind it, I suppose Apache web server needs to check for every request for an image and see where such request comes from, so in some way it should decrease performances.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

HTTP requests have a header field called "Referer". This is simply the URL from which you made the current request. This field is sent by browsers on most requests. (There's no referer if you typed a URL in the address bar. And you can configure your browser to not use one, or to fake one...) The hotlink protection you mention simply checks if the referer value is from a different domain than yours, and blocks or redirects the request if that's the case.

So, yes, there's obviously some overhead involved in making this check. But probably not huge. (I honestly can't say) I'd recommend you just pay attention to the server resource usage.

share|improve this answer
add comment

Apache is going to check where every request comes from anyway (since it has to be able to send it back), so hotlink protection will definitely not hurt performance.

share|improve this answer
    
Not sure about that. How is hotlink protection implemented? Likely it's using mod_rewrite in a .htaccess, there is definitely some overhead there, even if it is very small. –  davr Feb 23 '10 at 23:20
    
True, but the performance gain of sending a tiny image (or none at all) vastly outweighs that quick operation. –  Jess Feb 24 '10 at 1:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.