8000 GitHub - asleepace/proxy-web-view: Runs a local server which intercepts HTTP requests which can be preloaded to the webview.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

asleepace/proxy-web-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

proxy-web-view

Runs a local server which intercepts HTTP requests which can be preloaded to the webview.

UPDATE: Now supports TLS*

Running the local server with a https://0.0.0.0:8888 connnection works*, but results may vary depending on how the certificates actually work.

Local HTML Remote HTTP
Simulator Screenshot - iPhone 15 - 2024-05-23 at 02 07 22 Simulator Screenshot - iPhone 15 - 2024-05-23 at 02 07 22

How it works?

The application starts a local TCP server running at http://0.0.0.0:8888 via the LocalServer class, which will try to match incoming requests with files found in the bundle. This works for loading a website via a local HTML file, or from a remote domain using HTTP.

Much of the code was obtained from this article:

Limitations

Since the assets are serverd over HTTP:// and not HTTPS:// this will cause problems when mixing insecure content.

Next Steps

The following approaches attempt to mitigate the mixed context issue.

  1. Assets to be loaded locally use a custom scheme my-app:// along with the WKURLSchemeHandler
  2. Reuests are proxied via the ProxyURLProtocol which does a sort of MITM with content
  3. Manage to locally sign the TCP server to serve secure content?

Testing

You can use the following two links to text a file which contains assets with http://0.0.0.0:8888 link

Generating SSL Certificates

openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 3650 -keyout my.key -out my.cer;

Then we need to convert this to a .der file:

openssl x509 -in certificate.crt -outform der -out certificate.der

To generate the proper SSL certificates for the server, you can use the following commands:

openssl pkcs12 -legacy -export -out client.p12 -inkey my.key -in certificate.der

Related Links

About

Runs a local server which intercepts HTTP requests which can be preloaded to the webview.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0