Being able to host services at home on the end of a broadband connection is great until those services start to get noticed by some of the less bright ‘net users out there. I have no problem with my site, wiki, gallery etc. being spidered by search engines and being Googleable. People might find something of use on there one day. I also accept that should any of the content generate too much legitimate traffic I’ll have to move it elsewhere. However, recently I’ve noticed a lot of bandwidth getting used for long periods of time. Use of
tail -f /var/log/apache/access.log has shown that some anti-social individuals are deep linking to pictures in my gallery. These are generally photos of the cats, and large ones at that. Several megabytes a time, in fact. (Two in particular have linked to a huge image and then resized it to a couple of hundred pixels each way.)
Now, I’m happy that Bailey and Gizmo are so cute that they’re admired by people all over the world. But I want my bandwidth back! The general web guru that is Graham Bleach pointed me at the Apache mod_rewrite guide (search for the section headed “Referer-based Deflector”). This little tip gives me the ability to redirect any incoming requests from a given referer to any other destination. At this stage I toyed with being very evil (I have my BOFH shirt on today too!) and redirecting the image requests to tubgirl or similar. However, I decided to be a slightly nicer person and created a small image file to use instead. This small image is hosted on the webspace provided by my ISP. So although the initial HTTP request and the redirect information come up and down my line, nothing else does.
Hopefully this will relieve the strain on my bandwidth and might educate a few people into changing their ways.Pin It