title: Custom http header on UIWebView requests causing back button to break
body: <p>I'm using the following code to inject a custom http header into my UIWebView requests:</p>
  
  <pre><code>func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -&gt; Bool {
          let headerFields = request.allHTTPHeaderFields
          var headerIsPresent = contains(request.allHTTPHeaderFields?.keys.array as [String], "X-Test-App")
  
          if headerIsPresent || navigationType == UIWebViewNavigationType.Other {
              return true
          } else {
              dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
                  dispatch_async(dispatch_get_main_queue(), {
                      let url = request.URL
                      var newRequest: NSMutableURLRequest = request as NSMutableURLRequest
                      // set new header
                      newRequest.addValue("MyValue", forHTTPHeaderField: "X-Test-App")
  
                      // reload the request
                      self.webView.loadRequest(newRequest)
                  })
              })
              return false
          }
      }
  </code></pre>
  
  <p>The problem is that the back button history is not being kept. So if I click like 3 requests deep. When hitting back, it will only go to the previous page and then hitting back again will result in it going back to the page you just went back from. It's basically an endless loop between the 2 most recent requests. Any idea how I can modify the above code to be able to keep the entire web history and allow the back/forward buttons to function as expected?</p>