You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please provide support/implementations to enable proxy in iOS
We are currently working on some enterprise applications which will be deployed to corporate devices via their MDM systems and they will enforce proxy on these devices. I was horrified seeing this bit of warning in my .NET MAUI app
May be this is bit late for our project and we will have to abstract and have platform specific, unmanaged HttpClientHandlers to support proxy in iOS devices. Is there any proposal anywhere or official workaround? Apologies, if there is any and I have somehow missed it.
Hi, just ran into this problem when migrating away from an old Xamarin project.
Since Proxy settings is not supported (anymore?), what would be the default behavior on iOS if not setting the proxy by code? Would the app respect any proxy from the system settings on the device, or try to go directly bypassing the proxy?
If bypassing, is there any workarounds to this since waiting until .NET 9 is not an option due to Xamarin EOL..
Hi, just ran into this problem when migrating away from an old Xamarin project.
Since Proxy settings is not supported (anymore?), what would be the default behavior on iOS if not setting the proxy by code? Would the app respect any proxy from the system settings on the device, or try to go directly bypassing the proxy?
If bypassing, is there any workarounds to this since waiting until .NET 9 is not an option due to Xamarin EOL..
Thanks
Yes, it will use the system proxy settings.
You might also be able to use the .NET http handler instead of the native one, by setting this in your csproj:
This will not use the system proxy (the app itself doesn't have access to the system proxy settings (in particular any passwords), so the .NET http handler doesn't either).
Now maui is in a relatively stable place, will there be support for this natively without the workaround described?
Using a proxy is important to an app I am working on and I dont want to lose the advantages of the native platform (there will be device proxies setup for example). Any idea of when this change would come into effect?
There is a workaround by using SocketsHttpHandler which is supported on iOS. For example:
var proxy = new WebProxy("http://your-proxy-url:port") // Replace with your proxy
var handler = new SocketsHttpHandler
{
UseProxy = true,
Proxy = proxy,
// Make sure to reuse TCP connections, but still refresh it every 5 minutes for DNS updates
PooledConnectionLifetime = TimeSpan.FromMinutes(5)
};
var client = new HttpClient(handler);
Activity
rolfbjarne commentedon Aug 4, 2023
From @Eilon on Thu, 03 Aug 2023 21:03:20 GMT
@rolfbjarne - does this seem like it should move to xamarin-macios or dotnet/runtime?
Syed-RI commentedon Aug 4, 2023
Glad to see that the issue is getting a bit of attention! ❤️
M4ttsson commentedon Sep 19, 2023
Hi, just ran into this problem when migrating away from an old Xamarin project.
Since Proxy settings is not supported (anymore?), what would be the default behavior on iOS if not setting the proxy by code? Would the app respect any proxy from the system settings on the device, or try to go directly bypassing the proxy?
If bypassing, is there any workarounds to this since waiting until .NET 9 is not an option due to Xamarin EOL..
Thanks
rolfbjarne commentedon Sep 19, 2023
Yes, it will use the system proxy settings.
You might also be able to use the .NET http handler instead of the native one, by setting this in your csproj:
There are a few downsides:
Axemasta commentedon Jan 5, 2024
Now maui is in a relatively stable place, will there be support for this natively without the workaround described?
Using a proxy is important to an app I am working on and I dont want to lose the advantages of the native platform (there will be device proxies setup for example). Any idea of when this change would come into effect?
rolfbjarne commentedon Jan 8, 2024
@Axemasta no news yet, but we're trying to have a look at this in the .NET 9 time frame (no promises though).
Pamoi commentedon Mar 12, 2025
There is a workaround by using SocketsHttpHandler which is supported on iOS. For example:
[Foundation] Implement NSUrlSessionHandler proxy support. Fixes dotne…
[release/10.0.1xx] [Foundation] Implement NSUrlSessionHandler proxy s…