Setup Proxy for Xamarin / MAUI development

The short collection of fast steps about setup HTTP Proxying for iOS and Android development with Xamarin.

Charles Proxy

Fiddler

Xamarin / MAUI specific

  1. If you use the native (AndroidClientHandler, NSUrlSession) HTTP handler, then nothing needs to be done.
  2. If you use HTTP handler by default (managed), follow above:

Setup the proxy with a custom HttpClientHandler:

var handler = new HttpClientHandler
{
    // local ip, charles port
    Proxy = new WebProxy("192.168.0.52", 8888)
};

Then use it whenever you create an HttpClient in your app:

var client = new HttpClient(handler);

// TODO: make some requests to test charles!

More resources

Теги: xamarin , maui , proxy , памятка