Closed Bug 696595 Opened 13 years ago Closed 8 years ago

Cached 301 redirects should have a default expiry time

Categories

(Core :: Networking: Cache, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: rowan.collins, Unassigned)

References

Details

When an HTTP 301 (Moved Permanently) response is received, this response is cached by default. It seems that if no cache control headers are present, this cache entry is given no expiration date, and will last until the cache is manually cleared or the profile is destroyed.

While this could be considered valid under RFC 2616 (such responses are described simply as "cacheable unless indicated otherwise"), many redirects in the real world fall into this category, and were probably not intended by their authors to be immortal in this way. ("Permanent" need not mean "whatever unexpected circumstances occur in future"; I have written further on this here: http://rwec.co.uk/q/cached-redirs)

It would be better if such redirects were given a default lifetime, e.g. 6 or 12 months from time of load. This would give web administrators a timeframe after which the old redirecting URL could be put to a new use.

Steps to reproduce:
1. Visit http://www.h2g2.com/ in Firefox
2. Visit about:cache-entry?client=HTTP&sb=1&key=http://www.h2g2.com/

Actual result:
Cache entry is listed as "expires: No expiration time"

Expected result:
Cache entry is listed with an expiration date a finite time in the future
If there's no expiration time, then the ordinary algorithm is run (just like every other browser). I forgot how old Netscape used to cal it, but Internet Explorer calls it "Check for newer version of stored pages - automatically". See <http://kb.mozillazine.org/Browser.cache.check_doc_frequency> for the configuration setting.

The auto setting looks at the creation and modification timestamps to determine if a page needs re-fetching (an old page that hasn't been modified in a long time is probably not modified recently). That might not work well with your Thingummy scenario.
See also bug 688668 which will remove cached 301/302 if it leads to an error.
I've just run into this problem. I think that it would be better if the redirects weren't cached at all.
See Also: → 1118475
301 is eligible for caching.. whether or not we do so and for how long depends on the response headers.. just as a 200 does
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.