• Resolved Yworld

    (@yworld)


    Hello, thanks for supporting a great plugin!

    Due to the big problem of the influx of bots, is it possible to create a condition in the plugin?
    The cache works for “good” bots and disables the cache for visits with an empty referrer.

    	$userAgent = $_SERVER['HTTP_USER_AGENT'];
    
    $down_reg = mb_strtolower($_SERVER['HTTP_USER_AGENT']);
            $down_reg = str_replace(array(' '), '', $down_reg);
    
            $find_bot_step1 = str_replace(array('yandex', 'google', 'pinterest'), ' this_is_bot! ', $down_reg);
            $find_bot_step2 = explode(' ', $find_bot_step1);
    
            if (isset($find_bot_step2[1]) == "this_is_bot!") {
    
                return true;
           }
    
    Here we catch an empty referrer and disable the cache (!empty($_SERVER["HTTP_REFERER"])) {

    It is necessary to send all bots for verification, otherwise it will not work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @yworld,

    The page cache should be working good with empty user agent, could you test it with curl eg:

    curl YOUR_TEST_URL -A ""

    If you entered a rejected user agent, they might be ignored such as “facebookexternalhit”

    Please ensure that the user agent is not rejected in your Powered Cache settings. If the problem persists, kindly share the URL and your Powered Cache configuration. You can send it via email to [email protected] if you prefer not to share publicly.

    Regards,

    Thread Starter Yworld

    (@yworld)

    @m_uysl Thank you very much for the advice.
    I seem to have figured it out, it’s all about my plugin and its filters, I’ll modify it and everything will work.

    You have the best caching plugin!

    Plugin Author Mustafa Uysal

    (@m_uysl)

    Glad to hear that you’ve sorted out the problem, and thank you for the update.

    Be careful, especially when using powered_cache_rejected_user_agents filter ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Condition for filtering bots’ is closed to new replies.