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
- Setup for Android: The Android Emulator and Charles Proxy: A Love Story
- Setup for iOS: Charles Proxy: Setup for iOS
- More: Charles Proxy Mobile Guide
Fiddler
Xamarin / MAUI specific
- If you use the native (
AndroidClientHandler,NSUrlSession) HTTP handler, then nothing needs to be done. - 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!