• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Read Client IP Address behind Proxy

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranch,

we have a requirement to fetch IP address of client machine and display it on the user page, for that i used a JSP page which does like below :



This works fine, when the system is connected directly to internet, but when its connected thru a Proxy server we receive only its proxy server IP address instead of the Client Local IP.

Is there any way we can retrieve the Client IP running behind proxy?

Thanks in advance.
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think there's no way to get the client IP who is behind the proxy, not atleast in servlet API
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this a client-side proxy, or a server-side proxy? If the former, then that information is most likely not available. If the latter, then there may be a custom request header (something like "X-Forwarded-For") into which the proxy puts the IP address. That's what an Apache would do that sits in front of a Tomcat.
 
Imran Akbar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its a client side Proxy.

I appended the code



and i was able to fetch the IP of the client local machine behind proxy.

 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic