views:

1580

answers:

3

We are using ProxyPass to redirect all "/r" requests to jboss on port 18080 as follows:

ProxyPreserveHost on
ProxyPass /r http://localhost:18080/redirectService/
ProxyPassReverse /r http://localhost:18080/redirectService/

But, that causes the IP address logged in jboss's access log as "127.0.0.1". Does somebody know how can we preserve the original IP from where the request came in HttpServletRequest? We want to acesss it from jboss servlet request in doGet()

+2  A: 

You can get the original host from X-Forwarded-For header field.

andri
+1  A: 

If you have the capability to do so, I would recommend using either mod-jk or mod-proxy-ajp to pass requests from Apache to JBoss. The AJP protocol is much more efficient compared to using HTTP proxy requests and as a benefit, JBoss will see the request as coming from the original client and not Apache.

jkf
A: 

You could try using XForwardedFilter.

Paul