IE add cache-control:no-cache to 302 redirect
Recently I came across a tricky problem about browser caching. We are working on an SaaS web project and users are identified by login names. Homepage can be viewed after login and is cache by cache directives. So if 2 accounts belong to different tenants log on the same computer without cache clearing, the second user is probably to see the wrong homepage (homepage of another tenant). This problem appears on Firefox and Chrome, but not on IE.
Then I google and found this on stackoverflow:
http://stackoverflow.com/questions/398068/ie-302-redirect-no-cache-header-problem
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.
This explains why the problem doesn’t show on IE. The no-cache header will force the server to return the correct homepage, instead of 304 response code indicating using client-side cache.
There are also several differences about caching behavior between IE and Firefox. Check this:
http://blog.httpwatch.com/2008/10/15/two-important-differences-between-firefox-and-ie-caching/
最近评论