• Resolved Ivan Salloum

    (@ivansalloum1)


    Hello,

    I’ve noticed numerous entries in my log file indicating that Ninja Firewall is blocking access to?admin-ajax.php?due to bot detection being enabled. Interestingly, the blocked IP is actually the IP of the server hosting my website. Here is a sample entry that repeats about 100 times:

    06/Aug/24 09:30:02 #3277172 MEDIUM - 85.90.244.229 POST /wp-admin/admin-ajax.php - Blocked access to admin-ajax.php - [bot detection is enabled] - ivansalloum.com

    Does anyone have any insights into what might be causing this issue?

    Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author nintechnet

    (@nintechnet)

    The policy is “NinjaFirewall > Firewall Policies > WordPress AJAX > Protect admin-ajax.php against bots”. By default, it is disabled.
    Normally, if you enabled that policy, it shouldn’t block your server’s IP address. Maybe your server has multiple IPs? Check below the policy, the IP will be displayed: does it match the blocked IP?

    Thread Starter Ivan Salloum

    (@ivansalloum1)

    Thanks for your reply.

    No, it is showing the IP of the docker container of my website. What to do in this situation?

    Plugin Author nintechnet

    (@nintechnet)

    You’d need to disable the “NinjaFirewall > Firewall Policies > WordPress AJAX > Protect admin-ajax.php against bots” policy. It is disabled by default, and the reason is because many plugins or themes may need to access the admin AJAX API.

    Thread Starter Ivan Salloum

    (@ivansalloum1)

    I disabled it but is there any workaround to leave it on? Do I need to leave it on when having my website inside a container?

    Plugin Author nintechnet

    (@nintechnet)

    If you want to whitelist that IP so that you can enable that option, you can use the .htninja script.
    Here’s an example of code to add to the file, that will whitelist IP 1.2.3.4 :

    <?php
    /*
    ===========================================================================================+
    | NinjaFirewall optional configuration file
    | See: https://blog.nintechnet.com/ninjafirewall-wp-edition-the-htninja-configuration-file/
    +===========================================================================================+
    */

    if ( $_SERVER["REMOTE_ADDR"] == '1.2.3.4' ) {
    define('NFW_UWL', true);
    return 'ALLOW'; // whitelist
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.