IE 302重定向无缓存标头问题 [英] IE 302 Redirect No-Cache Header Problem

查看:215
本文介绍了IE 302重定向无缓存标头问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发布信息后,将返回302重定向。此重定向旨在重新加载当前页面。

A 302 Redirect is being returned after a post of information. This redirect is intended to reload the current page.

这一切正常,但是IE在标头中添加了No-Cache:

This all works fine, but IE adds No-Cache to the header:

Cache-Control: no-cache

我们正在使用Squid来缓存内容,并将其放置在标头中会绕过squid。

由于这种重定向使用非常频繁(没有办法解决),这会大大增加系统的负载。

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.

Firefox没有此问题,它只是请求重定向的页面而无需更改标题,这正是我们想要的。

Firefox doesn't have this problem, it simply requests the redirected page without changing the header which is exactly what we want.

有什么办法可以阻止IE添加无缓存?

Is there anything we can do to stop IE from adding no-cache?

推荐答案

令人着迷。这确实是IE问题,没有直接的解决方法。问题是IE将无条件地向HTTP POST请求添加Cache-Control:no-cache请求标头(或者如果您有代理,则为Pragma:no-cache请求标头)。

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中引入的,用于适应无法正确处理HTTP POST请求并错误返回缓存响应的错误代理服务器。

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的一个古怪之处在于,当您重定向时,无缓存头会重新添加到重定向的请求中。因此,就您而言,您的重定向请求还会发送从POST请求继承过来的 no-cache请求标头。

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用户重定向到使用JavaScript将其重定向回到原始页面的插页式页面。 (不过,请勿使用META REFRESH,因为它总是发送不缓存的请求。)

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 302重定向无缓存标头问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆