title: Alamofire: Follow HTTP redirects (or not)
body: <p>I'm trying to configure Alamofire to follow redirects (or not) on a per-request basis.</p>
  
  <p>Alamofire has a private internal class <code>SessionDelegate</code> which serves as the <code>NSURLSessionTaskDelegate</code> for the current URL session. <code>SessionDelegate</code> does implement the relevant delegate method, <code>URLSession(session:, task:, willPerformHTTPRedirection response:, request:, completionHandler:)</code> which is exactly what I want.</p>
  
  <p>Even better, the delegate's implementation consults a custom variable closure named <code>taskWillPerformHTTPRedirection</code> to determine how to handle the redirect - again, exactly what I want!</p>
  
  <p>And as far as I can tell, that closure is always <code>nil</code> by default -- it is not assigned to internally by Alamofire -- which suggests that it is intended to let the user assign a closure to it.</p>
  
  <p>The problem: I cannot access this private <code>SessionDelegate</code> class to assign a closure to its <code>taskWillPerformHTTPRedirection</code> variable. It is a private class and it is not visible to my Swift files. What is the proper means of configuring an Alamofire request to (not) follow redirects?</p>