Chrome is caching even with HTTP no-cache headers

一世执手 提交于 2019-12-07 04:58:56

问题


I am trying to serve a PHP file output with HTTP Headers configured so the content will NOT be served from cache in Chrome.

If I go to Dev tools (in Chrome), and mark the "Disable cache" option, then it works.

But I don't want to depend on that, I hope I can setup HTTP headers in a way I can force Chrome to reload the page everytime.

Here's a screenshot of my current attempt, please note the red marks.

Could you please provide good documentation or which headers I must declare for this ?

Thanks in advance.

Edit

So I found this other reply too: Chrome caching like a mad browser, but since I recall being told that Chrome needs special headers for Cache-Control, I will keep this question.


回答1:


Web browsers can cache AJAX requests with the same request parameters. In order to work around this problem, use a query string that changes. One example would be to use the date in seconds as a query parameter.



来源:https://stackoverflow.com/questions/12220998/chrome-is-caching-even-with-http-no-cache-headers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!