• Resolved Scamaz

    (@scamazdid911)


    A little bit confused in setting up Ninjafirewall with Cloudflare.

    Is the .htninja file supposed to be created already? If so I’m having troubles finding it.

    If not and I’m supposed to create it/copy the htninja.sample or is it only supposed to contain the “server variables” part referring to Cloudflare?

    // Users of Cloudflare CDN:
    if (! empty($_SERVER[“HTTP_CF_CONNECTING_IP”]) &&
    filter_var($_SERVER[“HTTP_CF_CONNECTING_IP”],FILTER_VALIDATE_IP)) {
    $_SERVER[“REMOTE_ADDR”] = $_SERVER[“HTTP_CF_CONNECTING_IP”];
    }

    I’ve since tried both and (.htninja is being detected according to the overview tab…”Optional configuration file”)…but it’s still only reporting Cloudflare IPs in the live log when anyone visits.

    And it’s still giving the warning:

    HTTP_CF_CONNECTING_IP detected: you seem to be using Cloudflare CDN services. Ensure that you have setup your HTTP server or PHP to forward the correct visitor IP, otherwise use the NinjaFirewall .htninja configuration file.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Scamaz

    (@scamazdid911)

    resolved this myself, but wanted to verify if that warning message is always there regardless if ips are being pulled correctly when using Cloudflare?

    • This reply was modified 8 years, 2 months ago by Scamaz.
    Plugin Author nintechnet

    (@nintechnet)

    Hi,

    The message should go away if the .htninja is working.

    Can you go to “About… > System Info” and check the value of “REMOTE_ADDR”: Is it the Cloudflare IP or your real IP?

    Thread Starter Scamaz

    (@scamazdid911)

    hmm ok then i guess it’s not resolved. live log is showing info like this:

    [09/Jan/17:00:31:49 -0600] – x.x.x.x (cloudflare ip) “Mozilla/5.0 Firefox/50.0 etc” “x.x.x.x (actual ip)”

    since i was seeing the actual IP at the end I figured it was working, but I still get that message….so i guess it’s not.

    and I see a Cloudflare IP at on the System Info tab

    • This reply was modified 8 years, 2 months ago by Scamaz.
    • This reply was modified 8 years, 2 months ago by Scamaz.
    • This reply was modified 8 years, 2 months ago by Scamaz.
    Plugin Author nintechnet

    (@nintechnet)

    Make sure the .htninja is correct, i.e., it should start with ‘<?php’, as it is a regular PHP script. Copy and paste this code:

    <?php
    /*
     +===================================================================+
     | NinjaFirewall optional configuration file                         |
     |                                                                   |
     | See: https://nintechnet.com/ninjafirewall/wp-edition/help/?htninja |
     +===================================================================+
    */
    
    // Users of Cloudflare CDN:
    if (! empty($_SERVER["HTTP_CF_CONNECTING_IP"]) &&
     filter_var($_SERVER["HTTP_CF_CONNECTING_IP"],FILTER_VALIDATE_IP)) {
    	$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
    }
    
    
    • This reply was modified 8 years, 2 months ago by nintechnet.
    Thread Starter Scamaz

    (@scamazdid911)

    Did you mean to make that Cloudflare?

    Plugin Author nintechnet

    (@nintechnet)

    I edited my message: it should be $_SERVER[“HTTP_CF_CONNECTING_IP”], not $_SERVER[“HTTP_INCAP_CLIENT_IP”] ??

    Thread Starter Scamaz

    (@scamazdid911)

    that worked! I guess I must have not copied it correctly the first time? I also rebooted the server….maybe i forgot to do that before? i dunno if that mattered.

    i have one more issue, i’ll open a new thread.

    • This reply was modified 8 years, 2 months ago by Scamaz.
    • This reply was modified 8 years, 2 months ago by Scamaz.
    • This reply was modified 8 years, 2 months ago by Scamaz.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Ninjafirewall only displaying Cloudflare IPs’ is closed to new replies.