title: Problems with caching using NSURLConnection and querying HTTP Headers
body: <p>I am trying to write a crude app to loop round querying some of the HTTP Header fields that come back from my server in order to find out which servers are responding OK. My servers respond with a header like this:
  server = server1 (or server2, server 3 etc).</p>
  
  <p>Unfortunately when I do this I get the same server name back time and time again from the app unless I stop it and run it again at which point I get a different server back. How can I stop this happening? I need the app to treat each connection as if it is brand new, but it seems to cache something and appear to come from the same place, so my load balancer returns the same server name. </p>
  
  <p>I can replicate similar behaviour(expected) in Safari by going to my URL repeatedly without shutting down Safari - it gets the same server each time, but if I shut down Safari then go back into it I get a new server.</p>
  
  <p>The code I am using is as follows:</p>
  
  <pre><code>for (int i = 0; i &lt; 999; i++) {
      request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];
  
      [NSURLConnection sendSynchronousRequest: request returningResponse: &amp;response error: nil];
      if ([response respondsToSelector:@selector(allHeaderFields)]) {
          dictionary = [response allHeaderFields];
          fullHeaderString = [dictionary description];
      }
  }
  </code></pre>
  
  <p>How can I make this connection be treated like a new one every time?</p>
  
  <p>Cheers,
  Tom</p>