tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Finding the Apache httpd IP address when AJP is used
Date Fri, 01 May 2015 15:54:10 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Paul,

On 4/30/15 5:21 PM, Paul Klinkenberg wrote:
> You were totally on your way to come to the point where my original
> question was aimed at, and then suddenly, bam, a right turn ;-) 
> That happened when you write "getRemoteAddr() Returns the Internet
> Protocol (IP) address of the client or last proxy that sent the
> request." Yes, that is normally the case, but not when using AJP. 
> The missing link in the story is the "translation" that AJP does: 
> -------------------------------------------------------- 1) browser
> --- HTTP --->  httpd front-end 2) httpd front-end --- AJP --->
> Tomcat-AJP 3) Tomcat-AJP   --- HTTP --->  Tomcat-HTTP (and back off
> course:  ----> AJP ----> httpd ----> browser ) 
> -------------------------------------------------------- I doubt
> whether the AJP connector really sets up an http connection, which
> the arrow "---HTTP--->"  implies at position 3). I do know that
> both the servletrequest and the valve present inside the http
> connector, think it is a genuine http request coming from the
> browser-client, not an ajp one. For example, debug results show: 
> request.getProtocol() : HTTP/1.1 request.getRemoteAddr() : [ip of
> the browser-client] request.getLocalPort() : 80   <<< not 8080! 
> request.getCoyoteRequest().getWorkerThreadName() :
> ajp-nio-8009-exec-1   <<< The _only_ reference I could find to
> anything non-http, but this is a string... And I needed to use
> reflection to get to the coyote request.
> 
> What I wanted to know, indeed out of intellectual interest, is
> what you described perfectly (even though it was hard to write):
> the ip address of the httpd front-end server.
> 
> I really don't want to exhaust your time on a hunt for something 
> that is just nice to know, but won't be used afterwards. But I
> (again!) much appreciate the time you took to dive into this quest
> I gotten myself into ;)

I'm trying to figure out why I can't get these request attributes to
show in my env environment, but you should be able to get a handful of
variables from the request attributes:

https://tomcat.apache.org/connectors-doc/generic_howto/proxy.html#Fine%2
0Tuning

I can't seem to get those httpd environment variables to show up in my
request attributes. Maybe I'm using the wrong names.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVQ6GiAAoJEBzwKT+lPKRYhpoP/jNyCdZ3eMz+UcnM1vHkL1ZB
yc0Xc1VWo8qNCF7Nezy2VAAEjiPCgw5HmKoNXmj7RDO1XaHprcDAsHNxuyzjFMvD
fbQ9KpD+swlIfLtFVetlcU1+xUGnZyXiIb12dly9czF7hTA4bTrkyogIa4Q68CJQ
SwFS2Bhnqvi/QFYuascCySXpttMVrgMf4GOC5zyuIv4Pz2AuSA27fsa/J3hXofSI
fMJ2qrs6tBXAE9Co/wM2HdLLjbbAplyXsd/Gzxl/kAC++eFmg8PSvQGUig0qKXOh
jZWa+xRnRL0gOW+lJ/56jhlgD21y/X1L73f74C+Eavph+WtCyFJ8lbM/HEOumC/Z
ARtZJ5p0v/JzmKRLmClG9JJkMydgLzIjZKOB5i/lkbQJQe6ZAbouH7CihLP3yD2i
Gy1CnuVDCDWGVjReMV2zksLWFIxqHRu450wrn7ZWb514krRrUxpj+En6Y+u5EOxW
DTgATrLdMZyH0pfYBIYUw4aEmQ9O2YmE0OxwwffTMRdeKLewqGTmu25G0OQB89hS
4llNp1ZkNcHHTMnQNE7ewBFJkQjuC9brHqTJCz9AD7qqLC7p9BiuiDLhsBloIWAb
dekhwt8Jy4jrfmyK48JpWKqBXjsg8c6S+dqE8etEzSe4U1RUv11nNDChA/MyvyLF
2o5anqRN3ez7vlY8x3B/
=lzjD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message