https://bz.apache.org/bugzilla/show_bug.cgi?id=58655

            Bug ID: 58655
           Summary: IllegalStateException: calling
                    HttpServletResponse#sendRedirect() with RemoteIpFilter
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: cristikl...@gmail.com

Created attachment 33299
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33299&action=edit
stacktrace of error

When calling `HttpServletResponse#sendRedirect()`, if `RemoteIpFilter` is in
use, an `IllegalStateException` is thrown (see attached stack-trace). 

The error steams from the way `RemoteIpFilter.XForwardedResponse` tries to
rewrite the 'Location' header. According to the servlet API, a response is
considered committed after calling `sendRequest()` and it is illegal to call
either `reset()` or another `sendRequest()` thereafter.

WORKAROUND:

Comment the code after `super.sendRedirect(location);`. However, this
effectively disables the `RemoteIpFilter` on the response path and makes the
server return an URL with incorrect scheme.

[1]
https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java#L679

[2] https://tomcat.apache.org/tomcat-8.0-doc/servletapi/index.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to