How long do browsers cache HTTP 301s?

前端 未结 15 2287
囚心锁ツ
囚心锁ツ 2020-11-22 14:43

I am debugging a problem with a HTTP 301 Permanent Redirect. After a quick test, it seems that Safari clears its cache of 301s when it is restarted, but Firefox does not.

相关标签:
15条回答
  • 2020-11-22 15:33

    Make the user submit a post form on that url and the cached redirect is gone :)

    <body onload="document.forms[0].submit()">
    <form action="https://forum.pirati.cz/unreadposts.html" method="post">
        <input type="submit" value="fix" />
    </form>
    </body>
    
    0 讨论(0)
  • 2020-11-22 15:35

    There is a very simple way to remove browser cache for http redirects e.g. 301, 307 etc.

    You can open network panel in developer console in chrome. Select the network call. Right click on it and then click on Clear Browser Cache to remove the cached redirection.

    0 讨论(0)
  • 2020-11-22 15:36

    For testing purposes (to avoid cached redirects), people can open NEW PRIVATE WINDOW: click CTRL+SHIFT+N [if you use Mozilla, use P]

    0 讨论(0)
提交回复
热议问题