How does Tomcat calculate the Last-Modified header date?

Viewed 324

I'm trying to get Tomcat to set an Expires header with the expires filter, so that browsers will check to reload a certain file more often. I'm finding I can get the Expires header correct, but Tomcat is setting a Last-Modified date that is wrong. It is essentially setting the date to the time that Tomcat started minus 1 month.

When a browser checks to see if it should reload the file, it sends that date back in If-Modified-Since, and then Tomcat apparently recalculates the same date and replies Nope nope nope, it hasn't changed! You're good! Even if the file has been modified recently.

This is nonsense. I can see from strace that Tomcat is running stat() on the file, but seems to ignore the date stamps therein.

So: Question: How does Tomcat calculate the last modification time of a file?? How I can I influence Tomcat to use the actual modification time in the filesystem, instead of Tomcat's own stupid restart time??

Tomcat 9.0.8.0 on Linux, handing out an application/javascript file.

0 Answers
Related