0

Is it possible to setup browser caching based on file modified time on the server instead of a fixed time since it was last fetched using the .htaccess file? Sometimes updates need to be pushed out to clients fast.

I wasn't sure what tags to use for this question so I tagged what I thought would be most relevant.

theshadow124
  • 661
  • 3
  • 8
  • 29
  • See if my this answer helps you .. http://stackoverflow.com/questions/32783257/how-do-i-set-my-web-site-to-cache-but-still-make-sure-the-user-has-the-most-rece/32790018#32790018 – hagrawal7777 Nov 21 '15 at 01:50
  • so, no there is no way to do this, ill set expire time to be 1 hour, this should reduce load significantly while still allowing me to push updating quickly\ – theshadow124 Nov 21 '15 at 01:55
  • You can, have a look at ETags. ETags can be based on many things, filemtime being one of them. You can also us an `If-Modified-Since` header. – Halcyon Nov 21 '15 at 01:56
  • so, from everything I'm reading etags should be pre-configured but they are not. is there any any way to force them? they are exactly what I need from what I've read. – theshadow124 Nov 21 '15 at 02:10
  • my bad guys, thanks for the help but it turns out i was doing all my tests and had forgotten to enable caching in Chrome's dev console. So now I'm getting 304(not modified) – theshadow124 Nov 21 '15 at 02:19
  • would it still be a good idea to set a expire time? or do all modern browsers support the Etag? – theshadow124 Nov 21 '15 at 02:20
  • Etags have fantastic browser support. But some really bad server side issues - especially in Apache: https://www.tunetheweb.com/performance/http-performance-headers/etag/ – Barry Pollard Nov 21 '15 at 09:26

0 Answers0