Hi everyone,
I'm trying to use OpenZiti within a mobile app that renders content via WebView (specifically using Swift for iOS). I want to ensure all WebView requests are tunneled through Ziti.
Has anyone successfully done this? Some questions I have:
- How can I intercept WebView traffic and route it via Ziti?
- Do I need to implement a custom URL protocol handler for this?
- Does OpenZiti provide any iOS SDK utilities specifically for WebView integration?
Any examples, advice, or documentation references would be highly appreciated!
Thanks in advance!
Hi @Dicky019 - welcome to the community!
Yeah, ZitiUrlProtocol
is a good place to start. ziti-sdk-swift/cziti.sample-ios at main · openziti/ziti-sdk-swift · GitHub provides an example of using it.
Depending on how your app is put together, you may need to update your URLSessionConfig
to add ZitiUrlProtocol
to the protocolClasses
array. You can see an example of that here that was built using AlamoFire: ziti-alamofire/ziti-alamofire/ViewController.swift at c372c0e742e51ac3948aa4dcdcf130445b751ad2 · openziti/ziti-alamofire · GitHub
The above examples just put the returned data from the URLRequest
s into a TextView
, but WKWebView | Apple Developer Documentation looks like it works similarly.
1 Like
Is it possible to use: webView.load(URLRequest(url: someURL))
in an iOS app with the OpenZiti SDK and have all WKWebView traffic automatically routed through Ziti?