Summary: | ExpiresFilter not account for 304 when content-type is null | ||
---|---|---|---|
Product: | Tomcat 8 | Reporter: | some.java.guy |
Component: | Catalina | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 8.5.x-trunk | ||
Target Milestone: | ---- | ||
Hardware: | PC | ||
OS: | Linux |
Description
some.java.guy
2019-11-08 22:12:39 UTC
“CustomExpiresFilter” should be “ExpiresFilter” in original config example in description. 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. 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 |