I recently had to MiTM an HTTP/2 connection over TLS and realized there is no MiTM tool out there that fully supports HTTP/2 over TLS, and no articles/blog posts written about this topic. After struggling with this for a while, I decided to post my solution to this problem.
The problem:
Standard MiTM tools don't support HTTP/2.
SSLSplit and Burp do not offer any kind of support, and instead just downgrade the connection to HTTP1.1. If the server only accepts HTTP/2 requests, you will get the following error:
Unexpected HTTP/1.x request
mitmproxy offers only partial support. For my use case it didn't work however, as I ran into the following error described here, which currently has no fix:
Initiating HTTP/2 connections with prior knowledge are currently not supported
I will post my answer below, and leave this thread open in case anyone has anything else to add, or a better solution.