According to RFC 9110, the memo that sets the standard for the Hypertext Transfer Protocol (HTTP), a 301 redirect is heuristically cacheable unless defined otherwise in the HTTP method’s definition or caching directives in the Expires or Cache-Control HTTP header.
In other words, it’s normal behavior for browsers to cache responses to requests with a status code of 301. In fact, to make the World Wide Web economic for webmasters and performant for users, it’s expected of them to do so!
As web performance architect Paul Calvano explains in his blog, if you don’t set the Expires or Cache-Control headers in your web server’s responses, a browser can cache the resources on it “forever.”
Now, I put “forever” in quotes because, at some point in the service life of their device, the user could clear the cache, reset their phone or tablet to factory settings, or reinstall the OS on their computer—which would forcibly clear the cached redirection.
(There’s also the edge case that, eventually, the browser automatically deletes the cached 301 redirect to make room for other caches from the user’s more recent browsing activity.)
This, as you can probably guess by now, has important implications for anyone who relies on 301 redirects to develop or operate their website or web application.
For starters, if you don’t want a 301 redirect to be locally cached in users’ browsers forever, you should set appropriate Expires or Cache-Control headers in your web server’s HTTP responses.
Setting 301 redirects aside for a moment, this also means that you should consider appending the URLs of resources that are likely to change—CSS files, JS scripts, others—with version parameters to signal to browsers when a new version is live even if the cache for the old version is still considered fresh.
How Different Browsers Handle 301 Redirects
Of course, this is all good to know, but it’s not very helpful if you’re developing a website or web application and you’re trying to deal with a cached 301 redirect. So let’s talk about how different browsers handle 301 redirects—and what you can do about it.
Does Google Chrome Cache 301 Redirects?
Yes, Google Chrome caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Chrome keeps the cached response indefinitely.
To clear the cache for a 301 redirect in Google Chrome, you must manually clear the browsing cache or hard-reload the URL in question. Alternatively, you can open the Developer sidebar, navigate to the Network tab, toggle Disable Cache on, and refresh the URL.
Does Microsoft Edge Cache 301 Redirects?
Yes, Microsoft Edge caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Edge keeps the cached response indefinitely.
To clear the cache for a 301 redirect in Microsoft Edge, you must manually clear the browsing cache or hard-reload the URL in question. Alternatively, you can open the Developer sidebar, navigate to the Network tab, toggle Disable Cache on, and refresh the URL.
Does Mozilla Firefox Cache 301 Redirects?
Yes, Mozilla Firefox caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Firefox keeps the cached response indefinitely.
To clear the cache for a 301 redirect in Firefox, you must manually clear the browsing cache or hard-reload the URL in question. Alternatively, you can open the Developer Tools sidebar, navigate to the Network tab, toggle Disable HTTP Cache on, and refresh the URL.
Does Safari Cache 301 Redirects?
Yes, Apple’s Safari browser caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Safari keeps the cached response indefinitely.
To clear the cache for a 301 redirect in Safari, you must open the Developer sidebar, navigate to the Network tab, toggle Disable Cache on, then refresh the URL.
In Conclusion
Yes, browsers cache 301 redirects indefinitely unless there are cache directives in the HTTP response headers that specifically say otherwise. The only ways to clear these caches is to clear the browser cache, perform a hard reload, or disable caching altogether.