vBulletin 5 real IP behind load balancer on Amazon

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marky
    New Member
    • Sep 2013
    • 19
    • 5.0.X

    vBulletin 5 real IP behind load balancer on Amazon

    Hi,

    We currently have vBulletin 5 and it's behind a load balancer on Amazon. Due to it behind a load balancer everyone who uses the forum has the same IP address.

    I did some searching to see if anyone is experiencing the same problem and didn't find anything relevant for vB5... just for vB4. For example, I found this:

    http://www.vbulletin.com/forum/forum...rror-need-help

    Over there it tells people to disable the "Use Login "Strikes" System" - which was the original cause of the IP investigation. Since we want this system enabled, we want to find a way so everyone is treated with a unique IP. Reading further, this thread said to update a core vB function that gets the IP address:

    http://www.vbulletin.org/forum/archi.../t-149401.html

    Therefore, we updated the following file:

    /var/www/html/core/includes/class_core.php

    and changed:

    PHP Code:
     630         function fetch_ip()
     
    631         {
     
    632               return $_SERVER['REMOTE_ADDR'];         // original: commented out on 11/27/13 due to same IP for all users
     
    633         
    to:

    PHP Code:
     630         function fetch_ip()
     
    631         {
     
    632                 return $_SERVER["REMOTE_ADDR"] = ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"] );
     
    634         
    After this was updated successfully, we tried doing a couple of posts to see if it logged the correct IP next to the post... but it didn't work. We're not using CloudFlare, so the index we need to use is "HTTP_X_FORWARDED_FOR", and not "HTTP_X_REAL_IP" as the linked forum post says.

    We tried the above snippet of code on a test.php file and it did actually get our real IP, so we know the snippet is correct.

    Looking at the same class_core.php file we noticed the function fetch_alt_ip(), when is this function used? Will this function return the correct IP?

    Is there a way to get the original IP? Does vB5 officially supports this IP behind a load balancer scenario?

    Thanks.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...