title: NSURLRequest lost HTTP header “Authorization” while redirecting the request
body: <p>We have a problem with downloading files from the server in background mode. The HTTP header “Authorization” field is lost while redirecting the request to another server. </p>
  
  <p>We made some experiments and noticed that other fields (even the same but with underscore symbol at the end “Authorization_”) work perfectly in redirect. Looks like this field is erased according to some security reasons like if different servers use different authentication data. </p>
  
  <p>It is possible to append “Authorization” field manually in foreground mode using </p>
  
  <pre><code>URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:
  </code></pre>
  
  <p>method. There’s a problem when we tried to use redirect request in background mode. Because according to the documentation "Tasks in background sessions automatically follow redirects.”.</p>
  
  <p>I cannot find anything about skipping this field in <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html" rel="nofollow">RFC 2616</a>, but suppose that probably there’s some undocumented solution to save “Authorization” field during redirect in background mode. </p>
  
  <p>Let me assume that our front-end server may provide some special field in redirect response that would say that redirected server is trusted and we can use “Authorization” field without any modifications.</p>
  
  <p>That is just an idea and probably we have to use it somehow else. Could you direct us please?</p>