Open fuggly opened 2 years ago
By default, all traffic from WKWebView doesn't go through the HTTP Proxy from your iPhone, so Proxyman could not capture it.
Ref: https://developer.apple.com/forums/thread/110312
So, from what I experience, there is no way to capture traffic from WKWebview on iOS devices.
if you use Proxyman for iOS, I believe that the traffic from WKWebview can be captured because "Proxyman for iOS" uses the VPN, instead of a local proxy server.
Oh cool thanks, using the VPN I can see the traffic on my device. Cool, thanks!
Thanks, good to know.
So I need to install proxyman on a MAC book?
@Eddcapone yes, it's. Websocket is a features from the Macbook/Windows version 👍
@NghiaTranUIT Thx, I can confirm that it works on a MAC book. But your wrote Websocket is a feature from Macbook/Windows version, then why does it not work on windows?
@Eddcapone it should work on Windows and Linux too.
@NghiaTranUIT It works, but it does not catch all requests on windows. If I use the mac book, then it catches everything.
@Eddcapone then, it's not a bug from Proxyman. Some Windows apps don't respect the System HTTP Proxy. Their requests go directly to the Internet. So, Proxyman can't capture it.
You might find the Proxy Setting in your Windows app, to see if we can override it.
@NghiaTranUIT It has nothing to do with windows itself, I just host proxyman on a windows machine. I connected from an iphone to proxyman and it did not capture most of the requests.
On the original point, it's now possible (iOS 17+) to show WKWebView traffic in Proxyman if you manually configure the webview's proxy configuration: https://developer.apple.com/documentation/webkit/wkwebsitedatastore/4264546-proxyconfigurations
@esteluk does it work with fetch/axios on WKWebView ?
Thanks @esteluk . Confirmed that Proxyman can capture traffic from WKWebView
Here is the sample code:
Set HTTP Proxy to WKWebView
lazy var webView: WKWebView = {
let webConfiguration = WKWebViewConfiguration()
// ✅ define Proxy Setting to Proxyman
let httpProxy = ProxyConfiguration(
httpCONNECTProxy: NWEndpoint.hostPort(
host: NWEndpoint.Host(
"127.0.0.1"
),
port: NWEndpoint.Port(
integerLiteral: 9090
)
)
)
// ✅ Tell WKWebView to use the Proxy
let dataSource = WKWebsiteDataStore.default()
dataSource.proxyConfigurations = [httpProxy]
webConfiguration.websiteDataStore = dataSource
// init view
let webView = WKWebView(
frame: .zero,
configuration: webConfiguration
)
webView.translatesAutoresizingMaskIntoConstraints = false
return webView
}()
Proxyman 3.8.0 Mac Monterey 12.5
I apologise if this has been answered somewhere before, but I couldn't really find anything, so I will ask here:
I cannot see any requests from WKWebView. Funny enough, I can see all other requests that we make with our iOS app (outside WKWebview). But those that come from a WKWebView, including the first loading request, but also all other links that are clicked inside, are not visible in Proxyman. We use Atlantis as well and have it running not he debug builds, but regardless of Atlantis included, running or not, WKWebView requests are invisible.
Is there anything we can do to make them visible? Or something we can troubleshoot?