質問

I've implemented server independent eTags on my site and I'm now looking at adding expires headers to prevent most of the 304 requests.

I'm concerned about using long expiration headers since it makes it tough to force a refresh if you need to update content. And I'm also not a big fan of cluttering my code with versioning query strings like:

<link rel="stylesheet" type="text/css" href="/style.css?version=X" />

So I'm thinking about setting the expiration header to something short like 10 minutes for almost everything. This way, I only have a possible 10 minute window of stale content, yet for a normal browsing session, I'm going to stop most of the 304s. And even if they do stay longer, I'll just be serving one 304 every 10 minutes unless the content changes.

It seems pretty elegant, yet I've seen a lot of sites using the above versioning querystring method, and even google's mod_pagespeed has an option to more or less do versioning automatically, so I'm just curious if this is a solid appropach or if I've missing something that makes it impractical.

Thanks

役に立ちましたか?

解決

And I'm also not a big fan of cluttering my code with versioning query strings like:

Why? No one sees it, and you can easily automate it - have your CMS or framework automatically append the file's modification time or md5 hash to the link tag.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top