-
Couldn't load subscription status.
- Fork 1k
Blocking Bots on Your AVideo Platform
AVideo includes a native mechanism to identify and block unwanted automated access based on the User-Agent header sent by HTTP clients. This feature helps mitigate abusive crawling, bandwidth waste, content scraping, and bot-based attacks, while allowing reputable crawlers (e.g., Googlebot) to function normally.
- Protect your server resources from abusive or unknown bots.
- Reduce unnecessary traffic and CPU usage.
- Maintain compatibility with trusted bots like search engine crawlers.
- AVideo inspects every incoming HTTP request’s
User-Agentheader during early initialization (ininclude_config.php). - If the header matches any pattern listed in
$global['stopBotsList'], the request is blocked immediately. - If the header also matches a value in
$global['stopBotsWhiteList'], the request is allowed. - If the
User-Agentis empty or unrecognized, the system ignores bot checks.
The check is enforced before sessions are started or the database is connected, ensuring low resource impact.
Edit the file:
/var/www/html/AVideo/videos/configuration.php
Add the following array to define patterns of unwanted bots:
$global['stopBotsList'] = array(
'headless', 'bot', 'spider', 'rouwler', 'Nuclei', 'MegaIndex',
'NetSystemsResearch', 'CensysInspect', 'slurp', 'crawler',
'curl', 'fetch', 'loader'
);These entries will be matched case-insensitively against the incoming User-Agent string.
To allow specific bots, even if they match the blocked terms, define:
$global['stopBotsWhiteList'] = array(
'google', 'facebook', 'bing', 'yahoo', 'yandex', 'twitter'
);These bots are allowed regardless of partial matches in the block list.
Here’s how your configuration might look with both lists added:
<?php
$global['webSiteRootURL'] = 'https://example.com/';
$global['systemRootPath'] = '/var/www/html/AVideo/';
$global['stopBotsList'] = array('headless', 'bot', 'spider', 'rouwler', 'Nuclei', 'MegaIndex', 'NetSystemsResearch', 'CensysInspect', 'slurp', 'crawler', 'curl', 'fetch', 'loader');
$global['stopBotsWhiteList'] = array('google', 'facebook', 'bing', 'yahoo', 'yandex', 'twitter');
require_once $global['systemRootPath'].'objects/include_config.php';🛑 Do not modify other global variables like
$global['salt'], database credentials, or system paths unless instructed.
-
User-Agent:
Mozilla/5.0 (compatible; MegaIndexBot/1.0) -
Matches:
MegaIndex(instopBotsList) ✅ -
Not in:
stopBotsWhiteList❌
➡️ Blocked with response:
Bot Found [MegaIndex] Mozilla/5.0 (compatible; MegaIndexBot/1.0)
-
User-Agent:
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) -
Matches:
bot(instopBotsList) ✅ -
Also matches:
google(instopBotsWhiteList) ✅
➡️ Allowed. Request continues as normal.
- Matching is based on
stripos()(case-insensitive substring match). - If the request method is
HEADand$global['stopHeadRequests']is set, the request will be blocked regardless of bot rules. - You may log rejected bot attempts by customizing the
error_log()line insideinclude_config.php.