dio icon indicating copy to clipboard operation
dio copied to clipboard

How to use proxy with dio_http2_adapter

Open longphanmn opened this issue 3 years ago • 3 comments

I can set proxy with default httpClientAdapter. But with dio_http2_adapter, cannot set proxy. Anyone know how to set proxy with dio_http2_adapter?

longphanmn avatar Aug 27 '21 10:08 longphanmn

the same question for me. Anyone know?

swoderheart avatar Aug 28 '21 09:08 swoderheart

you can use charles + postern to catch http2, may be need to trust charles certificate on your phone

m369848622 avatar Oct 15 '21 02:10 m369848622

I can set proxy with default httpClientAdapter. But with dio_http2_adapter, cannot set proxy. Anyone know how to set proxy with dio_http2_adapter?

No, you can't set proxy with this implementation of dio_http 2_adapter. The reason is that dart http 1 client implement tunnel proxy out of box, http2 dont. You can write your own implementation of Connection Manager that support tunnel connection. Example is here: https://github.com/dart-lang/http2/issues/48#issuecomment-749491710

To get proxy host and port you need to ask system like this in android: System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")

Neronse avatar Jun 22 '22 08:06 Neronse