Use cookie to transfer it between your ssl and nonssl page.
Main Topics
Browse All TopicsMy apache server is behind a load balancer that, when using SSL only gives me the IP address of the load balancer, not the client. When NOT using the SSL I can get the IP address from x-forwarded-for header (or something like that.) I'm looking for a javascript that I can run on an SSL page that will pull the correct IP off of a non-ssl page. My non ssl page would only present the IP address, something like
http://www.domain.com/ip.p
<? echo $_SERVER['x-forwarded-for'
And for testing , I just want to alert('$ip') and get the IP address spit out.
Oh, and it shouldn't throw up any "do you only want to view secure parts in the page" errors.
Any ideas?
This question is in progress.
Our experts are working on an answer right now.
Sign up for immediate access to the solution once it becomes available.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
gurvinder372
I copied the script to a browser and IE and chrome both gave me javascript errors.
I don't know java, but getLocalHost looks like it's getting the machine's IP address. 80% of consumers now are behind NAT, and it's almost always going to give me 192.168.1.x. I need the IP they originate from, although it would be interesting to have their local IP as well, but not nearly as important.
no answer here.
The javascript method only gives the internal network, not their IP on the internet... most people behind a firewall so that's no good.
Remote_addr is the obvious solution, but it's blocked by the load balancer, hence the problem.
Setting with cookie is no good because they start off on an SSL page. I'm looking for a javascript to pull the data off a non-ssl page, and give it to the SSL version, and NOT give an error, but that may just be impossible.
Please refund
Business Accounts
Answer for Membership
by: gurvinder372Posted on 2009-11-04 at 19:36:47ID: 25746554
If your browser supports Java, you can have the Client IP by using the following IP address:
calHost(); string(ipS tr.indexOf ("/")+1));
<SCRIPT>
var ip = new java.net.InetAddress.getLo
var ipStr = new java.lang.String(ip);
document.writeln(ipStr.sub
</SCRIPT>