Posts Tagged ‘Scripts’

Hosting : Why does every visit to my website have the same IP address?

September 4th, 2008

Reference: http://help.mosso.com/article.php?id=180

Your script is calling for the “REMOTE_ADDR” and receives the IP of a server in front of one of our back-end servers. The web facing server is then passing the scripts output without giving the expected REMOTE_ADDR of the visitor. In order for your scripts to recognize that they are on a cluster and log the correct IP of your visitors, you will need to replace and add the code below.

For PHP:
Locate any lines of code that are similar to this snippet of code,
$_SERVER['REMOTE_ADDR'];
And replace it with this snippet of code,
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];

For ASP:
Locate any lines of code that are similar to this snipper of code,
Request.ServerVariables(“REMOTE_ADDR”)
And replace it with this snipper of code,
Request.ServerVariables(“HTTP_X_CLUSTER_CLIENT_IP”)

My fix for this required a unix shell (if you’re on a Windows look at installing cygwin on your system.

# Ftp your web content down to your local system

$ for file in `find <path_to_files> -exec grep -l REMOTE_ADDR {} \;`; do base=`basename $file`; sed ‘s/REMOTE_ADDR/HTTP_X_CLUSTER_CLIENT_IP/g’ $file > /tmp/$base; grep HTTP_X_CLUSTER_CLIENT_IP /tmp/$base >/dev/null 2>&1 && grep REMOTE_ADDR $file && echo “Updated $base” && mv
/tmp/$base $file; done

# Then simply upload the changed files to your system.

  • Share/Bookmark

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Posted in web_programming | Comments (0)

Scripts

June 18th, 2008

Over the past 10 years of consulting, I’ve come up with various scripts that others would find useful: perl, shell and otherwise, including vbscripts for windows WMI and ITM5.x Resource Model visitTrees.

As I get around to organizing this blog, I’ll make them available in some kind of structure.

Go to the Scripts Tag

  • Share/Bookmark

Tags: , , , , , , , , , , , ,
Posted in Documentation | Comments (0)

  • LinkedIn

    If you want to see my LinkedIn profile, click on this button:

    Jim Sander
  • Save MySQL

JDS Media is Digg proof thanks to caching by WP Super Cache