<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gernot Pansy &#187; iPhone</title>
	<atom:link href="http://gernot.pansy.at/tag/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://gernot.pansy.at</link>
	<description></description>
	<lastBuildDate>Sun, 16 Sep 2012 20:57:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>iOS 6 GM HTTP POST Cache Bug</title>
		<link>http://gernot.pansy.at/ios-6-gm-http-post-cache-bug/</link>
		<comments>http://gernot.pansy.at/ios-6-gm-http-post-cache-bug/#comments</comments>
		<pubDate>Sun, 16 Sep 2012 20:42:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[POST]]></category>
		<category><![CDATA[XHR]]></category>

		<guid isPermaLink="false">http://gernot.pansy.at/?p=17</guid>
		<description><![CDATA[In RFC 2616 (chapter 9.5) is clearly written that it is not allowed to cache POST requests, unless the response includes appropriate Cache-Control or Expires header fields. In iOS 6 it seems apple cache sometimes POST requests. In iOS 6 &#8230; <a href="http://gernot.pansy.at/ios-6-gm-http-post-cache-bug/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In RFC 2616 (chapter 9.5) is clearly written that it is not allowed to cache POST requests, unless the response includes appropriate Cache-Control or Expires header fields. In iOS 6 it seems apple cache sometimes POST requests.</p>
<p>In iOS 6 Apple also implemented the ability to debug websites via USB &amp; your desktop browser like Chrome for Android. With this new feature it is easy to debug such problems.</p>
<p>Here you see a screenshot which shows this XHR POST request (grey marked) with new tool:</p>
<p><a href="http://gernot.pansy.at/wp-content/uploads/2012/09/ios-post-cache.png"><img class="aligncenter size-full wp-image-18" title="ios-post-cache" src="http://gernot.pansy.at/wp-content/uploads/2012/09/ios-post-cache.png" alt="" width="1366" height="768" /></a></p>
<p>The marked post request looks like an uncached request which goes to the remote server. But that&#8217;s not the truth. The request <strong>doesn&#8217;t contact</strong> the remote server &#8211; it only returns some <strong>old cached data</strong>. So don&#8217;t believe in the new remote debugging tool. Here it shows fictional rows/data.</p>
<p>Here you see the request in detail:</p>
<p><a href="http://gernot.pansy.at/wp-content/uploads/2012/09/ios-post-cache1.png"><img class="aligncenter size-full wp-image-19" title="ios-post-cache1" src="http://gernot.pansy.at/wp-content/uploads/2012/09/ios-post-cache1.png" alt="" width="1366" height="768" /></a></p>
<p>The response date in the header is some minutes old and also the data shown is not up-to-date.</p>
<p>The problem occurs in Safari browser and in the UIWebView. And it seems that the caching only occurs in the loading phase of a website. Perhaps Apple tried to improve the loading time of some sites but have forgotten that it is not allowed to cache HTTP POST requests.</p>
<h2>Solution (Server-Side)</h2>
<p>It works correctly if you add the header fields you normally use on HTTP GET requests to avoid caching.</p>
<pre>Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT</pre>
]]></content:encoded>
			<wfw:commentRss>http://gernot.pansy.at/ios-6-gm-http-post-cache-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
