x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Exclude IP from Throttling

Changes are made at your own risk and are not guaranteed to work. Always make backups of the database and files prior to implementing hacks. Make a special backup of the file and/or template you are modifying so that you can roll back quickly.

Hacks are dangerous and can cause your site to stop working. They make later updates to ExpressionEngine more difficult; you should track your hacks for post-update re-implementation. 

Most hacks are unnecessary, please review the Development Documentation for information on expanding ExpressionEngine via Modules, Extensions, and Plugins.

Hacks are never officially supported.

Question:

How can I exclude certain IPs from being throttled, without disabling throttling all together?

Anwer:

This requires a hack:

Open up core.system.php and find this:

if ($PREFS->ini('enable_throttling') [h3]'y' AND REQ[/h3] 'PAGE')
{
require PATH_CORE.'core.throttling'.EXT;

$THR = new Throttling();
$THR->throttle_ip_check();
$THR->throttle_check();
$THR->throttle_update();
}

What we are going to do is create an array of IP addresses and if an IP is not found in that array, then it does the throttle check:

if ($PREFS->ini('enable_throttling') [h3]'y' AND REQ[/h3] 'PAGE')
[code] {
// GoogleBot (range), MSNBot (full IP)
$pass = array('66.249.71.', '65.54.188.83');
$skip = 'n';

foreach(
$pass as $value)
{
if (strstr($IN->IP, $value))
{
$skip
= 'y';
}
}

if ($skip == 'n')
{
require PATH_CORE.'core.throttling'.EXT;

$THR = new Throttling();
$THR->throttle_ip_check();
$THR->throttle_check();
$THR->throttle_update();
}
}

Thread

Category:Hacks Category:SEO

Categories: