简体   繁体   中英

How to use mitmdump to translate http2 to local http?

I want to use curl http://127.0.0.1:8033/api/v1 to access https://http2.pro/api/v1 with HTTP/2

This API url will return whether the client using http2.

I have tried: (I'm using latest version 5.0.1)

./mitmdump -p 8033 --http2 --set http2_priority=true --mode reverse:https://http2.pro:443

However curl 127.0.0.1:8033/api/v1 still gives:

{"http2":0,"protocol":"HTTP\/1.1","push":0,"user_agent":"curl\/7.69.1-DEV"}

In contrast, curl https://http2.pro/api/v1 --http2 gives: (this is what I expected)

{"http2":1,"protocol":"HTTP\/2.0","push":0,"user_agent":"curl\/7.69.1-DEV"}

mitmproxy currently does not support converting between HTTP/1 and HTTP/2. For HTTP/2 to happen, both endpoints need to speak it. It is on our todo list and will hopefully be possible soon ( https://github.com/mitmproxy/mitmproxy/issues/1775 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM