The RFC seems to suggest that the client should permanently cache the response: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
10.3.2 301 Moved Permanently
The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.
The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).
If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request.
I'm having a hard time finding concrete browser documentation for any major browser that states how they handle these.
I've started digging through the source code of firefox, but quickly got lost.
Is the following scenario true for which (if any) browsers, and is there definitive documentation for either Firefox or IE that states as much?:
First Time Around:
Any Subsequent Times Around:
The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the requested resource has been definitively moved to the URL given by the Location headers. A browser redirects to the new URL and search engines update their links to the resource.
If you put a 301 redirect into operation, that redirect will be cached in the browser for any visitor's on your site. You can't clear the browser cache for your users, so if you need to change or undo a 301 redirect, the old redirect is still going to be in effect until their cache expires.
301 redirects are permanent. They mean that the page has moved, and they request any search engine or user agent coming to the page to update the URL in their database. This is the most common type of redirect that people should use.
I preformed some tests and found some browsers do cache the 301 result:
Caches 301 result and skips contacting old address in future? Internet Explorer 7 no Firefox 3.0 no Chrome 4.0 yes Opera 10.01 yes for google.com, no for www.rnhart.net
I used the following two 301 results to test with:
I started a proxy server on my own computer (Proxomitron Naoko 4.2 with all filters turned off). In each browser, I set the proxy settings to point to my own computer. I cleared the browser's cache, then I visited the old address multiple times and looked in the proxy server's log window to see what requests the browser made.
The first time the old address is visited, the proxy log shows the old address request, the 301 response, and the new address request. If the old address is visited again, the log either showed the same set of requests (the 301 wasn't cached), or it showed only the new address request (the 301 was cached).
I tested entering the old address in the address box, accessing the old address from a bookmark, and accessing the old address from a link on a page. Each browser worked the same way no matter how the address was accessed.
[I found this question while investigating a similar Super User question: Do browsers change URLs of saved bookmarks in response to 301 redirection?]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With