Views: 3410
Last Modified: 10.10.2012
  1. Pass the real IP address from front-end to back-end for proper statistics tracking. SQUID declares the HTTP_X_FORWARDED_FOR variable. To use this value, add the following code to /bitrix/php_interface/dbconn.php:
    if(strlen($_SERVER["HTTP_X_FORWARDED_FOR"])> 0&& $_SERVER["REMOTE_ADDR"]=="127.0.0.1")
    {
    if($p = strrpos($_SERVER["HTTP_X_FORWARDED_FOR"], ","))
      { 
      $_SERVER["REMOTE_ADDR"] = $REMOTE_ADDR = trim(substr($_SERVER["HTTP_X_FORWARDED_FOR"], $p+1));
      $_SERVER["HTTP_X_FORWARDED_FOR"] = substr($_SERVER["HTTP_X_FORWARDED_FOR"], 0, $p);
      }
    else
      $_SERVER["REMOTE_ADDR"]=$REMOTE_ADDR=$_SERVER["HTTP_X_FORWARDED_FOR"];
    }

    Note! This handler is not required if mod_realip is used. If this is the case, add "RealIP 127.0.0.1" or other back-end address to the server configuration file (httpd.conf) to have Apache rewrite the address.

  2. Disable KeepAlive in the back-end Apache configuration. Since front-end usually runs at the same machine, faster release of resources will result in the performance gain.


Courses developed by Bitrix24