title: How to prevent 301 response redirection from being cached, without disabling default redirection?
body: <p>I am implementing a REST client for a server I do not control. The server returns HTTP 301 with "Cache-Control: no-cache". NSURLConnection is caching the response in spite of the "Cache-Control" header. How do I prevent caching without reimplementing the whole HTTP redirection logic myself?</p>
  
  <p>I use simple NSURLConnection with NSURLRequestUseProtocolCachePolicy for the NSURLRequest.</p>
  
  <p>The NSURLConnection delegate method connection:willCacheResponse: is called for the final response after the redirection of 301, but not for the 301 response itself, which is too late - I can't identify which is the request for that response. So connection:willCacheResponse: is of no use to prevent caching.</p>
  
  <p>I do not want to use connection:willSendRequest:redirectResponse because otherwise I will have to reimplement the whole HTTP redirection logic myself.</p>
  
  <p>Any ideas how to solve this problem? </p>
  
  <p>Thank you for your patience. </p>