6

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.

HTTP headers

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.

Community
  • 1
  • 1
Niloct
  • 9,491
  • 3
  • 44
  • 57

1 Answers1

7

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.

Lucas Holt
  • 3,826
  • 1
  • 32
  • 41