How to get IE to not cache GET requests?

After testing our REST services it was found that in IE 11 the requests were being cached. We were not seeing this issue in Chrome.

So the easiest solution was to do the following.

  1. Go to Internet options in IE
  2. On General tab click Settings button (in browsing history)
  3. For ‘Check for newer version of stored pages check : ‘Every time I visit the web page’.
  4. Save changes.

Now I cannot expect our customers to do the same. So how do you do make the requests not cache and each call?

Headers to the Rescue

After playing around with different settings the following worked:

cache-control:n0-cache, pragma:no-cache, expires: -1

More information about these headers can be found here.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.