Featured post
apache - random numbers after a ? on an image is this for far expires headers? -
i pooking around random site on internet , noticed on images have numbers prefixing it: icons-16.png?1292032550
i've heard of people optimising websites far expires headers. if changes content doesn't change often, cache won't refreshed. ergo new image won't re-downloaded someones cache. because filename has change.
yes, intent force refresh of browser cache. however, i not recommend approach:
- many proxies (and possibly browsers) not cache anything query string, regardless of
cache-control
headers. you're shooting in foot if include superfluous query string – you'll needlessly consume own bandwidth sending images should cached, aren't. - depending on how configure server, user agents periodically make request cached resources,
if-modified-since
and/orif-none-match
header. if client's cache date, server responds304 not modified
, stops; otherwise responds normal200 ok
, sends new content. not have change resource's file name in order client caches updated when resource changes. trying clever query string serves defeat caching mechanisms. that said, if optimize caching setting
expires
date year out (and iflast modified
date of resource long ago), user agents may check updates infrequently. if unacceptable you, have 2 options: either reduce amount of time before resource expires (so browser issueget
request , can respond304
or200
appropriate), or use "url fingerprinting," random token included in path, instead of in query string. example:/img/a03f/image.png
instead of
/img/image.png?a03f
this way, resources still cached proxies. you'll want in using mod_rewrite allow include token in path. of course, need able change references url whenever change resource.
for further reading, highly recommend google's page speed best practices, section on optimizing caching.
- Get link
- X
- Other Apps
Comments
Post a Comment