473,395 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

PHP, Visitor IP address and invisible proxies

I was faced with a difficult configuration issue a few days ago with
another companys web service. In short, their web service requires the
user to login on their page before their service can be used through
another application. During the login phase the remote server tries to
determine the visitors ip-address and after that only allows the use of
the external application from that ip-address.

As most of us well know, there really is no reliable way to get the
visitors ip-address through php or other server-side scripting.
Troubleshooting my connection issues I found out that our ISP is using a
completely transparent proxy in between. It does not add extra headers
to its requests, so the webserver has no idea it is actually fetching
the proxys ip-address instead of mine.

Quite often proxies add the real ip-address in the request headers
($_SERVER["HTTP_X_FORWARDED_FOR"]), but my ISP's transparent proxy does
not do this. Obviously the service was unusable, and I know that there
would be other ways for the company to deal with the identification. I
Finally got around the issue after using some ugly workarounds.

(the "livehttpheaders" mozilla extension allows me to manually add
request headers to single page requests, although it is pretty much work
and has to be done manually for each request. My ISP's proxy seems to
pass these extra headers through untouched, so I was able to manually
define http_x_forwarded_for as my ip and got it all working, although
now this needs to be done with every login).

While investigating the problem I came to face 2 questions that I would
like answers to.

1) Despite the completely transparent proxy, I found 2 pages in the
internet that _did_ report my real IP-address despite of the proxy in
between. These were www.whatismyip.com and checkip.dyndns.org. Any and
all other such pages always returned my proxys ip-address instead. I
suspect that the two working sites use some much more sophisticated
technique to finding out my ip-address that just server variables or
headers, but I am unsure what that is (Some kind of routing analysis
perhaps?). So _how on earth do www.whatismyip.com or checkip.dyndns.org
find out the real ip-address instead of the completely invisible proxy
in between_ ?

2) In the future, to make analysing similar problems easier, or to just
add depth to the experiments with web services, it would help a lot to
have an easier way to set request headers. Are there any other
extensions/plugins/software to edit my request headers that the mozilla
livehttpheaders? It would be good if I could permanently set some
request headers that would always be applied to my requests, or applied
site-specificly.

Thanks in advance.

--
Suni

Jul 17 '05 #1
3 3462
"Juha Suni" <ju*******@ilmiantajat.fi> wrote in message news:<41***********************@news.song.fi>...
<snip>
1) Despite the completely transparent proxy, I found 2 pages in the
internet that _did_ report my real IP-address despite of the proxy in
between. These were www.whatismyip.com and checkip.dyndns.org.
Not for me, at least when I tried. So, I guess, your proxy actually
sends your IP to them in _some_ headers. Probably you should loop
through the $_SERVER variables to findout that.
Any and
all other such pages always returned my proxys ip-address instead. I
suspect that the two working sites use some much more sophisticated
technique to finding out my ip-address that just server variables or
headers, but I am unsure what that is (Some kind of routing analysis
perhaps?). So _how on earth do www.whatismyip.com or checkip.dyndns.org
find out the real ip-address instead of the completely invisible proxy
in between_ ?
Again I don't think so. But, it's quite easy to find if the IP is
proxy or not.
2) In the future, to make analysing similar problems easier, or to just
add depth to the experiments with web services, it would help a lot to
have an easier way to set request headers. Are there any other
extensions/plugins/software to edit my request headers that the mozilla
livehttpheaders? It would be good if I could permanently set some
request headers that would always be applied to my requests, or applied
site-specificly.


I don't know. Perhaps you should hack the source of
livehttpheaders?

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Jul 17 '05 #2
Juna,

There is no way of doing this reliably. The only way to guarantee that
you have the end users ip address and not an intermediate proxy is to
ensure that the request was HTTPS. The problem first came to light when
I discovered when looking at AOL users (the AOL network makes extensive
use of proxies that overwrite the end user's ip address during the
inbound request), and there were no HTTP headers, not even
HTTP_X_FORWARDED_FOR that would me the correct ip. In fact I managed to
demonstrate that the end user ip address could always hidden by opening
an AOL account for this express purpose.

Steve

Jul 17 '05 #3
R. Rajesh Jeba Anbiah wrote:
"Juha Suni" <ju*******@ilmiantajat.fi> wrote in message news:<41***********************@news.song.fi>...
<snip>
1) Despite the completely transparent proxy, I found 2 pages in the
internet that _did_ report my real IP-address despite of the proxy in
between. These were www.whatismyip.com and checkip.dyndns.org.

Not for me, at least when I tried. So, I guess, your proxy actually
sends your IP to them in _some_ headers. Probably you should loop
through the $_SERVER variables to findout that.


The transparent proxy set up by Telefónica (main company here in Spain)
adds x-forwarded-for to the headers:

if (getenv("HTTP_X_FORWARDED_FOR")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
$host = gethostbyaddr($ip);
$proxy = "sí: " . getenv ("REMOTE_ADDR");
} else {
$ip = getenv("REMOTE_ADDR");
$host = gethostbyaddr($ip);
$proxy = "no";
}


Any and
all other such pages always returned my proxys ip-address instead. I
suspect that the two working sites use some much more sophisticated
technique to finding out my ip-address that just server variables or
headers, but I am unsure what that is (Some kind of routing analysis
perhaps?). So _how on earth do www.whatismyip.com or checkip.dyndns.org
find out the real ip-address instead of the completely invisible proxy
in between_ ?

Again I don't think so. But, it's quite easy to find if the IP is
proxy or not.

2) In the future, to make analysing similar problems easier, or to just
add depth to the experiments with web services, it would help a lot to
have an easier way to set request headers. Are there any other
extensions/plugins/software to edit my request headers that the mozilla
livehttpheaders? It would be good if I could permanently set some
request headers that would always be applied to my requests, or applied
site-specificly.

I don't know. Perhaps you should hack the source of
livehttpheaders?

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bob Bedford | last post by:
Hello there, I'd like to get the visitor's email (not for spamming....) It's to avoid to show some content to my competitors....
10
by: Clive Backham | last post by:
I tried posting this on comp.infosystems.www.misc, but that group appears to get very little traffic. So now I'm trying here. If there is a more appropriate group, please let me know. I'm...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
5
by: olduncleamos | last post by:
Hi all. Is there any legitimate reason the IP address from a client will change between request? I am wondering if I can autheticate a session by making sure they all come from the same IP. I...
9
by: brett | last post by:
How can I get the IP address of a visitor to my site in ASP.NET 2.0? Please include the full namespace. Thanks, Brett
18
by: damezumari | last post by:
I would like to know how many of the visitors to my site has js enabled and how many has it turned off. I haven't found a simple solution searching Google groups so I suggest the following using...
3
by: bush | last post by:
hi everyone! i want to get the ipaddress,and the country name of a webpage visitor,using asp.Net(C#).if anyone knows about it,plz rply me. thanx in advance.
0
weaknessforcats
by: weaknessforcats | last post by:
Design Patterns: Visitor Introduction Polymorphism requires a class hierarchy where the interface to the hierarchy is in the base class. Virtual functions allow derived classes to override base...
8
by: Spence | last post by:
My web site is built using ASP.NET, the host supporting .NET 3.5, SQL Server Express and Access. I want to start collecting some visitor stats, in particular OS and Browser used, pages visited,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.