Announcement

Collapse
No announcement yet.

Proxy IP Header

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Proxy IP Header

    Hi, does this still work in V5 or was this feature removed .

    We just upgraded from 4 to 5 and I included this section but it does not seem to be working any more ?

    thanks

    G.

    PHP Code:
    #### Reverse Proxy IP #### 
    If your use a system where the main IP address passed to vBulletin is the address of a proxy server 
    and the actual 'real' ip address is passed in another http header then you enter the details here */

    /* Enter your known [trusted] proxy servers here. You can list multiple trusted IPs separated by a comma.*/
    $config['Misc']['proxyiplist'] = '100.50.75.25';

    /* If the real IP is passed in a http header variable other than HTTP_X_FORWARDED_FOR, then you can set the name here; */
    $config['Misc']['proxyipheader'] = 'HTTP_X_REAL_IP'

  • #2
    Hi, searching your code I see there is a Function called fetch_alt_ip() is this called automatically or is there a user setting to enabled this.

    I have verified that the forwarding header is being sent but its not matching the function. ?

    thanks

    G.

    Comment


    • #3
      As of right now in 5, you need to manually make changes.

      Here are my rough notes for the vBulletin 5 changes:

      In /core/includes/class_core.php, I changed this:
      PHP Code:
      function fetch_ip()
      {
      return 
      $_SERVER['REMOTE_ADDR'];

      to this:
      PHP Code:
      function fetch_ip()
      {
      // return $_SERVER['REMOTE_ADDR'];
      return $_SERVER['HTTP_X_REAL_IP'];

      and in core/vb/request.php (around line 204), I changed this:
      PHP Code:
      //These are set from the web page bot not from CLI
      if (!isset($_SERVER['REMOTE_ADDR']))
      {
      $_SERVER['REMOTE_ADDR'] = ;
      }
      return 
      $_SERVER['REMOTE_ADDR'];

      to this:
      PHP Code:
      //These are set from the web page bot not from CLI
      if (!isset($_SERVER['REMOTE_ADDR']))
      {
      $_SERVER['REMOTE_ADDR'] = ;
      }
      // return $_SERVER['REMOTE_ADDR'];
      return $_SERVER['HTTP_X_REAL_IP'];

      and then a few lines below that, see this:
      PHP Code:
      if (isset($_SERVER['REMOTE_ADDR']))
      {
      $alt_ip $_SERVER['REMOTE_ADDR'];

      and below it I added this:
      PHP Code:
      if ($_SERVER['REMOTE_ADDR'] == $_SERVER["SERVER_ADDR"])
      {
      $alt_ip $_SERVER["HTTP_X_REAL_IP"];

      You may need to change HTTP_X_REAL_IP to your header that is being passed.

      Comment


      • #4
        Hi Zachery, many thanks for the confirmation. I will make these changes tomorrow and let you know.

        Thanks again

        G.

        Confirmed working the CM will be happy his Google Analytics will be showing data again
        Last edited by gbrain; Tue 27 Jan '15, 3:30am.

        Comment


        • #5
          Glad you got this sorted.

          Comment

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