• Resolved Torsten

    (@knodderdachs)


    Hi,

    I have to use the REST API for one plugin, but I don’t want others to have access to the REST API. Is it possible (in the Pro Version of NinjaFirewall) to whitelist specific IP just for accessing the REST API while other IP getting blocked?

    Greetings
    Torsten

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

    (@nintechnet)

    Hi,

    I assume you are referring to the WP+ Edition, because the Pro and Pro+ are generic versions (i.e., not WordPress specific). There is indeed an IP whitelist option but we noticed a bug that does not whitelist the user when accessing the REST API. It will be fixed in the next release, available next month.

    In the meantime, if you are using Apache you can temporarily use some .htaccess rewrite rules:

    RewriteEngine On
    RewriteCond %{REMOTE_ADDR} !1.2.3.4
    RewriteCond %{THE_REQUEST} /wp-json/wp/v2/
    RewriteRule . - [F,L]
    

    Replace 1.2.3.4 with your IP. Be careful not to remove the ! character preceding the IP.
    Not the most elegant way (and not 100% bullet-proof) but it should work well as a temporary solution.

    Thread Starter Torsten

    (@knodderdachs)

    Hi,

    thanks for helping. Unfortunately the rewrite rule doesn’t work. It makes no difference. In the logfile I see that the IP is whitelisted but then it gets blocked. I think I have to wait for the bugfix in the next release.

    Greetings
    Torsten

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Whitelisting for using REST API’ is closed to new replies.