• Resolved CacheGuard

    (@cacheguard)


    Hi

    I use a reverse proxy in front of my Web server so whenever I receive a message the IP of the sender is set to the IP of my local reverse proxy.

    My reverse proxy add the X-Forwarded-For header to the HTTP requests so is there any possibility to get the real IP of the sender instead of the IP of my reverse proxy?

    Best Regards,

    https://www.ads-software.com/plugins/pirate-forms/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @cacheguard,

    Unfortunately, I am not able to test this, but if you want you can try to edit the file pirate-forms.php and let us know if it’s working.

    You need to change this line:

    $contact_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP );

    to:

    $contact_ip = $_SERVER['REMOTE_ADDR'];
    if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
        $contact_ip = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
    }

    If it’s helping, we can add this in a future update.

    Best regards,
    Rodica

    Thread Starter CacheGuard

    (@cacheguard)

    Dear rodicaelena

    It works perfectly! That was exactly what I was looking for. Thank you so much.

    Best Regards
    CacheGuard

    Hi CacheGuard,

    I’m really happy to hear this. We’ll add this in the next update, so you don’t have to change the code everytime you want to update.
    If you are happy with us and our product, you can always leave us a review here https://www.ads-software.com/support/view/plugin-reviews/pirate-forms#postform. It would help us a lot ??

    Thank you,
    Rodica

    Thread Starter CacheGuard

    (@cacheguard)

    I did it. Thanks again.

    Thanks a lot for that. Have a great day. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Web server behind a reverse proxy’ is closed to new replies.