I'm writing a web application and I need to make sure that I have the actual IP address and location of my visitors, since there are many users in Middle East and China using proxy services to bypass the restrictions there. Is there a way to detect this information behind a proxy?

1 Answer 1


Proxies run by national governments and ISPs will generally pass the carrier grade NAT (or in some cases, global) IPv4 address in the X-Forwarded-For header.

Some proxies, such as those used by some UK ISPs to implement that country's censorship schemes, are transparent proxies, and the connection appears to come directly from the IP address of the end user, as if there were no proxy. (Not all UK proxies are transparent; notably, those run by UK colleges and universities typically are not.)

If the user has set up their own proxy in order to bypass national government censorship, for instance, then there is little you can do; that information won't be available to you without performing black-hat operations which will get your site branded as a malware distributing attack site (and possibly delisted from Google or worse).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.