Firefox – ny way I can force Firefox to NOT cache redirects (301 and 302)

firefoxredirection

I am a web developer, and there are many times where I have to create or alter a 301 or 302 redirect. It is cumbersome to test immediate changes in Firefox because it caches redirects, so if I change the redirect server-side, and then hard refresh, the old redirect is cached, so the only way I can test the new one is by deleting my cache or starting a private browser session.

That being said, it is not particularly difficult to work around, but it is annoying, especially when I forget to do so, and it looks like my new redirect is not working, until I remember to delete the cache or start a new private session.

I understand why it is beneficial to cache redirects for normal use, but I would like to disable the behavior for debugging purposes.

Best Answer

You can set an option to turn off consulting the cache if you have the developer toolbox panel open (as it happens with F12).

To set this option:

  1. On any page, hit F12 to open the developer toolbox panel.
  2. Click the gear icon in the top right of that panel.
  3. There, check "Advanced Settings → Disable Cache (when toolbox is open)".

Cache redirects will still be cached from visits without the developer toolbox panel open, but that cache is not consulted and not updated as long as the developer toolbox is open. So you only temporarily force Firefox to not cache redirects or serve redirects from cache, but it could be enough for your use case.

Verified in Firefox 41. Adapted from Ryan Bemrose's answer to another question.

Related Question