dropwizard-configurable-assets-bundle icon indicating copy to clipboard operation
dropwizard-configurable-assets-bundle copied to clipboard

Enable not including Last-Modified header

Open mattmetlis opened this issue 5 years ago • 0 comments

I would like the ability to configure this assets bundle to omit - across the board - the Last-Modified header in response to GET requests.

Reasoning: I use Dropwizard in an environment where the file modification time is not computed correctly, and is always set to 0. This causes problems because the Last-Modified response header is set with 0, which encourages clients to use the If-Modified-Since header with a value of 0 on subsequent GET requests, resulting in 304s being returned when in fact that client's cached representation may no longer be valid.

I think it would make sense to add a boolean field and getter/setter to AssetServlet.java, and then to check that field before setting the header on the response - somewhat similar to the cacheControlHeader field. For consistency I think it also makes sense to do the same for setting the ETag response header.

I'm willing to provide a pull request with this change, but wanted to confirm you agree this would be a reasonable change.

mattmetlis avatar Sep 04 '19 19:09 mattmetlis