Here is a interesting project I found:

https://github.com/cortesi/mitmproxy