A 302 Redirect is being returned after a post of information. This redirect is intended to reload the current page.
在发布信息后,将返回302重定向。此重定向旨在重新加载当前页面。
This all works fine, but IE adds No-Cache to the header:
这一切都很好,但IE在标题中添加了No-Cache:
Cache-Control: no-cache
We are using Squid to cache our content, and putting this in the header bypasses squid.
As this redirect is used quite often(there is no way around this), this increases load on our system substantially.
我们使用Squid来缓存我们的内容,并将其置于标题中绕过squid。由于这种重定向经常被使用(没有办法解决这个问题),这大大增加了我们系统的负载。
Firefox doesn't have this problem, it simply requests the redirected page without changing the header which is exactly what we want.
Firefox没有这个问题,它只是请求重定向页面而不更改标题,这正是我们想要的。
Is there anything we can do to stop IE from adding no-cache?
有什么办法可以阻止IE添加无缓存吗?
2 个解决方案
#1
Fascinating. This is indeed an IE issue with no direct workaround. The problem is that IE will unconditionally add a Cache-Control: no-cache request header (or a Pragma: no-cache request header if you have a proxy) to a HTTP POST request.
迷人。这确实是IE问题,没有直接的解决方法。问题是IE将无条件地向HTTP POST请求添加Cache-Control:no-cache请求头(或者如果你有代理,则为Pragma:no-cache请求头)。
This was doubtless introduced in IE over a decade ago to accomodate buggy proxy servers which did not properly handle HTTP POST requests and would incorrectly return cached responses.
十多年前,这无疑是在IE中引入的,以容纳错误的代理服务器,这些服务器没有正确处理HTTP POST请求并且会错误地返回缓存的响应。
A quirk of IE is that when you redirect, the no-cache headers are re-added to the redirected request. Hence, in your case, your redirected request also sends the "no-cache" request header carried over from the POST request.
IE的一个怪癖是,当您重定向时,无缓存标头会重新添加到重定向的请求中。因此,在您的情况下,您的重定向请求还会发送POST请求中携带的“no-cache”请求标头。
Unfortunately, there's no direct workaround for this. You could redirect IE users to an interstitial page that uses JavaScript to redirect them back to the original page. (Don't use META REFRESH though, because that ALWAYS sends no-cache requests).
不幸的是,没有直接的解决方法。您可以将IE用户重定向到使用JavaScript将其重定向回原始页面的插页式页面。 (不要使用META REFRESH,因为它总是发送无缓存请求)。
#2
Sounds like a bug in IE to me. This discussion sounds similar. You could maybe try sending back a 301 or 307 response to see if it responds differently.
听起来像IE中的一个bug给我。这个讨论听起来很相似您可以尝试发回301或307响应,看看它是否有不同的响应。
#1
Fascinating. This is indeed an IE issue with no direct workaround. The problem is that IE will unconditionally add a Cache-Control: no-cache request header (or a Pragma: no-cache request header if you have a proxy) to a HTTP POST request.
迷人。这确实是IE问题,没有直接的解决方法。问题是IE将无条件地向HTTP POST请求添加Cache-Control:no-cache请求头(或者如果你有代理,则为Pragma:no-cache请求头)。
This was doubtless introduced in IE over a decade ago to accomodate buggy proxy servers which did not properly handle HTTP POST requests and would incorrectly return cached responses.
十多年前,这无疑是在IE中引入的,以容纳错误的代理服务器,这些服务器没有正确处理HTTP POST请求并且会错误地返回缓存的响应。
A quirk of IE is that when you redirect, the no-cache headers are re-added to the redirected request. Hence, in your case, your redirected request also sends the "no-cache" request header carried over from the POST request.
IE的一个怪癖是,当您重定向时,无缓存标头会重新添加到重定向的请求中。因此,在您的情况下,您的重定向请求还会发送POST请求中携带的“no-cache”请求标头。
Unfortunately, there's no direct workaround for this. You could redirect IE users to an interstitial page that uses JavaScript to redirect them back to the original page. (Don't use META REFRESH though, because that ALWAYS sends no-cache requests).
不幸的是,没有直接的解决方法。您可以将IE用户重定向到使用JavaScript将其重定向回原始页面的插页式页面。 (不要使用META REFRESH,因为它总是发送无缓存请求)。
#2
Sounds like a bug in IE to me. This discussion sounds similar. You could maybe try sending back a 301 or 307 response to see if it responds differently.
听起来像IE中的一个bug给我。这个讨论听起来很相似您可以尝试发回301或307响应,看看它是否有不同的响应。