简体   繁体   中英

How to get the clients host name behind apache2 reverse proxy and tomcat server?

I'm using apache2 as a reverse proxy in front of a tomcat8 server. I already make use of X-Forwarded-For to find the clients IP address.

But my goal is to get the clients hostname . Is that possible at all? Would I have to tell this to apache or to tomcat?

Through http, you'll get the client's public IP address, which might be their proxy, or their NAT router. You can use that IP address for a reverse DNS lookup, but as client computers rarely have publicly addressable DNS entries, you'll not get far. (In fact, you've asked precisely that question as well and got a good answer there)

As this question is specifically about the hostname , not about the DNS entry, here's where this answer differs from the answer to your other question:

The only option that I see to get to the hostname itself (something like "John's Mac") would be if the browser reveals it - eg through Javascript. If a browser would allow that, I'm sure that all the ad networks would be salivating over this leak of information. That's the reason why I expect the actual hostname being unavailable to you, without even looking up any option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM