I run a chain of proxy sites and bandwidth is becoming a major problem. What I'm looking to do is to find a module that allows me to block a user's ip if they exceed a limit of say 50mb for the day, and then forward them to a site stating that they have been blocked for 24 hours. Anyone know of a module or addon that can do this?
http://www.cohprog.com/mod_bandwidth.html that might be what your looking for also make sure that your not getting relay links at all that's where a site (usally porn) links all it's images via a proxy site to the images, so that the site itself can't get blocked, and has low bandwidth usage.
there are ways around it, if you check your referer logs, if there is a high amount of hits from one place you know they are doing it =)
How can i prevent the ways around it? Also where is the referrer log located? I googled it but the place where i found it is suppose to reside it is not there(/var/log/apache/referer.log).
Logs depend on the setup of the server you should have some type of stats package enabled (like awstats) most stats packages have a referer section in them so you could see where traffic is coming from. The code you posted in the other thread, try moving down the code to after the url is decoded, if that doesn't work you can find out which referers are sending the hotlinks and and put in some code that kills the script if it comes from that source. It's been a while since i have played with proxy's so am unsure on where it would be, and i used cgiproxy at the time so that would be even less help =)
I used the below code and its worked wonders the past 24 hours. Bandwidth per hour went from around 10-15 to 2-3. Just placed it at the top of index.php /* PHProxy bandwidth MOD 1.1 This MOD will stop any hotlinking via PHProxy, even if the clients referer is not set! Check out proxywebsite.org if you want to try hotlinking. */ // allow hotlinking from these sites, seperate by comma (make sure you eneter your site's domains) $domains="www.yourdomain.com,yourdomain.com"; // convert domains into an array $domains=explode(",",$domains); // if there is a request: if($_GET['q']!="") { // get referer $referer=explode("/",($_SERVER['HTTP_REFERER'])); // if the referer is not allowed: if(!in_array($referer[2],$domains)) { // redirect to homepage and finish script header("Location: http://".$domains[0]."/"); exit(); } } /* END MOD */ Code (markup):