tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Enrico Olivelli <eolive...@gmail.com>
Subject HttpServletRequest in AsyncContext does not handle X-Forwarded-For (RemoteIpValve)
Date Fri, 03 Nov 2017 12:18:53 GMT
Hi,
I am running a servlet and I get strange result for
HttpServletRequest#getRemoteAddr().

I have configured RemoteIpValve which handles the X-Forwarded-For header
and replaces the original IP address with the value contains in such header.

I have an HttpServlet which dispacts the execution to a custom threadpool
and uses request.startAsync()

It seems that if I call getRemoteAddr on the original HttpServletRequest
the value for getRemoteAddr() is correct, it contains the value of
X-Forwarded-For header.
When I call getRemoteAddr after calling startAsync() the result is the
original IP address of the request.

A workaround is to capture the IP Address early but I wonder if I am
missing something, if it is an expected behavior or if I should file an
issue.

I am using tomcat 8.5.15


Thanks
Enrico

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message