开发者

Disable cache on specific domains?

Is there a good way to disable cache for spec开发者_C百科ific domains? For example, anytime I start building a new website can I block just that domain from caching? I would prefer the rest of the internet to be cache-able.

I am currently using Firefox Web Developer Toolbar addon to disable cache, is there any better plugins?


Built-in Firefox Developer Tool has a features to disable cache for tabs where this toolbox is open.

Disable cache on specific domains?

Disable cache: disable the browser cache to simulate first-load performance. From Firefox 33 onwards this setting persists, meaning that if it is set, caching will be disabled whenever you reopen the devtools. Caching is re-enabled when the devtools are closed.

https://developer.mozilla.org/en-US/docs/Tools/Tools_Toolbox

Unfortunatley it's not per domain, but maybe this is better than Web Developer Toolbar.


You can send specific headers from your web application to prevent the browser from caching. You might send these headers only to your ip or browsers where a certain cookie is set.

Return these headers to prevent a browser from caching your content:

Cache-Control: no-cache, must-revalidate
Expires: Sat, 26 Jul 1997 05:00:00 GMT

Expires should be a date in the past.


The Charles Web Debugging Proxy is a good way to disable cache for specific domains. Just go to the Tools menu, then select No Caching. A window will open that lets you specify which locations to prevent caching on.

Charles is a proxy so you can use it to control the caching in all of your web browsers - Firefox, Chrome, IE, whatever you use!


I usually use a rewrite rule allowing /static/${NUMBERS}/directory/file.js to be served from /static/directory/file.js. Large files are treated separately (mp4, zip...). With PHP i set ${NUMBERS} to the UNIX_TIMESTAMP for development, and to VERSION_NUMBER for production. Now development is always downloaded but cdnjs almost never.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜