从带有查询字符串的 URL 缓存 [英] Caching from URLs with a query string
问题描述
我正在开发的 Web 应用程序提供带有像/image?name=a.gif 这样的 URL 的图像.页面加载缓慢的部分原因是浏览器没有缓存图像.
The web application I'm working on serves up images with URLs like /image?name=a.gif. Pages are loading slowly partly because browsers are not caching the images.
是否有任何 http 标头组合可以说服 IE 缓存图像,即使 URL 中包含查询字符串?我试图避免浏览器发出任何不必要的请求(包括 if-modified-since 类型请求)
Is there any combination of http headers that will persuade IE to cache the images even though the URL has a query string in it? I'm trying to avoid the browser making any unnecessary requests (including if-modified-since type requests)
我对仅适用于 IE (6+) 的解决方案感到满意.另外,我知道我可以通过 URL 重写来避免这个问题 - 我只是对更好地理解浏览器缓存感兴趣.
I'm happy with a solution that works with IE (6+) only. Also, I know that I can avoid the problem by URL rewriting - I'm just interested in understanding browser caching better.
谢谢
推荐答案
设置 expires将您的 Web 服务器中的标头发送到某个遥远的日期.
Set the expires header in your web server to some far away date.
这篇关于从带有查询字符串的 URL 缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!