ResourceServlet commits response preventing filters from modifying response headers after filterChain.doFilter
- regression from Jetty 11
#12766
Labels
Bug
For general bugs on Jetty side
Jetty version(s)
Jetty 12.0.16
Jetty Environment
EE10
Description
I'm migrating from Jetty 11 to Jetty 12 and noticed a regression. Headers set by our Filters after a call to
filterChain.doFilter
are missing or incorrect on certain URLs without any debug logging.I was able to trace it to the fact that
ResourceServlet
is committing the response here:After which modification of response headers in the filters after
filterChain.doFilter()
call are silently ignored inServletContextResponse
. For example:This looks like a regression from Jetty 11, as the filters were able to correctly modify the headers of the response with Jetty 11.
Could
ResourceServlet
/ResourceService
not commit the response to let the filters do their job?For additional context, this issue was hard to track and untangle because of the silent discarding of header modification. It would be nice to have at least a debug log if the header or status modification was rejected inside Jetty code because the response is already committed.
Test
I modified
ResourceServletTest#testOutputStreamAndCharsetFiltered
to reproduce the issue:Spikhalskiy@8054950
The text was updated successfully, but these errors were encountered: