I want to implement proxy server in node.js which is somewhat similar to Charles proxy - it should intercept HTTPS requests from my mobile app, decipher them, route some of them depending on body content to original backend and mock others with some static files.
- How this HTTPS stuff is handled in Charles or other proxies?
Technically, Charles Proxy or Proxyman.io (the one I'm using now) would do the following steps:
networksetup
CLI to easily achieve or Privileged Helper tool on macOS for high performance and secure.GET https://api.producthunt.com/v1/posts HTTP/1.1
- Will I need self-signed root certification mobile device?
Yes, you must install the Root Certificate in the first steps to your iOS device. For the Header/Response detail. Check chls.pro/ssl or proxy.man/ssl from those Charles or Proxyman, and see the content.
You can do it on iOS Simulator by using ADVTrustStore
- Are there any libraries which will help me?
You can check the those famous open source to see how it works - mitmproxy - zapproxy - http toolkit
Hope this can help you.