I am testing my web page on IE11. I am making some ajax calls and setting response headers as
Cache-Control: private, max-age=21600;
Though everytime making a request, IE11 sets Pragma:no-cache
request header. Causing request to get served from origin, though it should have been present in cache.\
Why does IE do that? Is there any way in IE to ignore this header?
Thanks.
IE does not cache the AJAX POST requests, so we are going to skip those, if any. Then, we need to add both Cache-Control: no-cache and Pragma: no-cache headers in order to make sure that our GET requests won't be cached.
A pragma header meant to prevent the client from caching the response, pragma means the browsers to tell the server and any intermediate caches that it wants a fresh version of the resource and vice-versa is not true.
I have tracked this down using Fiddler. It's a red herring. IE11 only sends the praga:no-cache
header when the development tools are open.
If you press F12
and close the development tools you will find that the no-cache
header is not actually sent on each request. If you just have the development tools open, the no-cache
header is sent.
You can check it out using fiddler.
Hope it helps...
You can turn that off when the tools are open by deselecting the circled button:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With