Patch to support nginx reverse proxy

[ad_1]

Hi, team. I run WordPress behind an nginx reverse proxy and login-lockdown blocks the proxy’s IP. I’d suggest this patch. Can it be incorporated?

Thanks!

--- wp-content/plugins/login-lockdown/libs/utility.php.orig
+++ wp-content/plugins/login-lockdown/libs/utility.php
@@ -129,7 +129,9 @@
   {
     $ip = '';

-    if (!empty($_SERVER['REMOTE_ADDR'])) {
+    if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+    } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
       $ip = $_SERVER['REMOTE_ADDR'];
     }

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer