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-controlheaders. 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-sinceand/orif-none-matchheader. 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
expiresdate year out (and iflast modifieddate 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 issuegetrequest , can respond304or200appropriate), or use "url fingerprinting," random token included in path, instead of in query string. example:/img/a03f/image.pnginstead of
/img/image.png?a03fthis 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