NEW 140571
Provide hook to alter (or at least add headers to) URL requests initiated from WKWebView
https://bugs.webkit.org/show_bug.cgi?id=140571
Summary Provide hook to alter (or at least add headers to) URL requests initiated fro...
Stuart Morgan
Reported 2015-01-16 15:43:55 PST
There are a variety of cases where it's useful to be able to modify a request being made by a WKWebView. For instance, Chrome for iOS has several features which are based on adding headers to requests to certain servers, for all requests to those servers. Doing this with UIWebView is possible using http/https protocol handlers, but in WKWebView it's apparently impossible to do except for requests that are initiated from outside the web view. It would be extremely helpful if there were a navigation delegate call (either a change to the existing one, or a new on) that would allow each NSURLRequest to be not just inspected, but potentially modified (at least the headers if not the whole request) before it was issued.
Attachments
Stuart Morgan
Comment 1 2015-06-01 11:15:42 PDT
Another case where this has come up is implementing Do Not Track, which requires adding a header to all requests. Per our offline discussion, a partial solution that avoids synchronous communication back would be just a way to register a server->header map (with wildcards), that would cause all future requests to those servers to add the corresponding headers. It doesn't address all use cases, but would be a significant improvement.
Stuart Morgan
Comment 2 2015-06-02 11:24:23 PDT
I forgot to note that this is rdar://19506439
Mike West
Comment 3 2015-09-04 06:40:00 PDT
This is apparently making Mozilla's foray into iOS a bit more difficult as well: https://mail.mozilla.org/pipermail/mobile-firefox-dev/2014-December/000993.html Alexey, could you help triage this to folks who might be able to look at the exposed API surface?
Mike West
Comment 4 2016-01-29 00:29:44 PST
John, Brent, perhaps one of you could route this to interested folks?
Note You need to log in before you can comment on or make changes to this bug.