Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does IE11 send 'pragma: no-cache' in request header for ajax requests?

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.

like image 937
sonam Avatar asked Aug 06 '14 10:08

sonam


People also ask

Does IE cache AJAX calls?

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.

What is Pragma cache control?

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.


2 Answers

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...

like image 92
Jim Avatar answered Nov 25 '22 18:11

Jim


You can turn that off when the tools are open by deselecting the circled button:

IE Network Tools

like image 24
Jordan H. Avatar answered Nov 25 '22 16:11

Jordan H.