<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [OSX, iOS] Need delegate API to modify requests before dispatching"
   href="https://bugs.webkit.org/show_bug.cgi?id=158812">158812</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[OSX, iOS] Need delegate API to modify requests before dispatching
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>iOS
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Critical
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebKit2
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>leo.natan&#64;outlook.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We are working on a security application, where we need to modify requests to route them through our backend infrastructure, to access internal resources.

So a request for <a href="https://example.acme/path/to/resource">https://example.acme/path/to/resource</a> would be modified to <a href="https://secure.acme.com/https://exmaple.acme/path/to/resource">https://secure.acme.com/https://exmaple.acme/path/to/resource</a> with some cookies added for session identification.

So far we have been using UIWebView on iOS, and we have setup NSURLProtocol to modify fields before they are dispatched by CFNetwork. 
We would like to move to WKWebView to take advantage of the new architecture. We need a way to modify requests at the client UI process, before they are dispatched to network. We need to modify fields such as URL and cookies.

 We understand this is not possible with out-of-process design, but we do believe some control should be give to the client UI process to control requests before dispatch.

We believe an API similar to -webView:decidePolicyForNavigationAction:decisionHandler: would be a good place to be able to modify the requests.

We discussed this with the WebKit guys at WWDC 2016, and we reached the conclusion to open this bug report.

Thanks</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>