Git Product home page Git Product logo

proxy-web-view's Introduction

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

proxy-web-view's People

Contributors

asleepace avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.