|Summary:||ExpiresFilter not account for 304 when content-type is null|
|Component:||Catalina||Assignee:||Tomcat Developers Mailing List <dev>|
Description some.java.guy 2019-11-08 22:12:39 UTC
Comment 1 some.java.guy 2019-11-08 23:07:47 UTC
“CustomExpiresFilter” should be “ExpiresFilter” in original config example in description.
Comment 2 Mark Thomas 2019-11-11 09:41:12 UTC
From RFC 7232, section 4.1: <quote> The server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 (OK) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary. </quote> I'm currently looking at ways to fix this. I'm not sure a complete solution is practical. A solution that addresses static resources and Servlets that override HttpServlet.getLastmodified() looks more likely.
Comment 3 Mark Thomas 2019-11-11 15:33:39 UTC
The Servlet API does not expose the information required to fix this for Servlets that override getLastModified(). That could be overcome by reflection but then the code would have to assume that the Content-Type for a given Servlet was constant. That may be true in most cases but it isn't guaranteed to true and I don't like building solutions based on assumptions I know to be false. The Default Servlet case can be fixed generically, and entirely in the ExpiresFilter but only by using Servlet 4.0 API. Therefore I have fixed this in 9.0.x using the Servlet 4.0 API and in 8.5.x using the Servlet 4 preview package. I don't see an easy way to fix this in 7.0.x. Fixed in: - master for 9.0.28 onwards - 8.5.x for 8.5.48 onwards