Other Cache-Control Headers for iOS6 AJAX Caching Bug

Last week, we discovered that, Safari in iOS 6 will aggressively cache AJAX POST requests.

There are two popular workarounds that people have proposed:

  1. Make URLs unique by adding query parameter, such as a timestamp, to the URL.
  2. Set the header, Cache-Control: no-cache, in the response

I noticed that some of my POST requests were not getting cached even though I had neither of these workarounds in place. After some poking around, I’ve discovered that having must-revalidate or no-store in the Cache-Control response header also works.

So, before you go adding no-cache to all of your POST responses, check to see if must-revalidate or no-store is already getting set.


I’ve published a simple Sinatra app that helped me test this: https://github.com/loganlinn/ajax-post-cache-test