I’m optimizing the web views of an iPhone app in preparation for Christmas traffic and one of the ideas I had was to use small increments of Expires header to cache files client-side. I assumed this would be no problem as all my work with Safari on the iPhone has shown it a very capable browser—as good as any desktop one.

Turns out after some testing that using Expires Header isn’t possible— not because of cache size limitations as one would assume. It looks like the guys in Cupertino wanted to limit this ability on the iOS as every HTTP request made by an iOS device issues a pragma: no-cache directive. I’ve yet to understand why. Better fire up more memcache servers.

Here’s the raw headers if interested:

GET /expires/ HTTP/1.1
Host: readystate4.com
User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: __utma=244034822.428964265.1285289496.1290546798.1290723961.13; __utmz=244034822.1285289496.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=1.1229958817.1285277083.1288920090.1292540519.14; __utmc=1; __utmz=1.1285277083.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Pragma: no-cache
Connection: keep-alive