alexrainman / ModernHttpClient

ModernHttpClient
MIT License
126 stars 27 forks source link

How to Enabled CLEARTEXT communication? #49

Closed GiuseppePennisi closed 4 years ago

GiuseppePennisi commented 4 years ago

Hi, i'm using this library to get some data from a rest service that has an HTTP base address and i can't manage it to use HTTPS instead of HTTP. Every time i do a rest call, it's throw an exception: System.Net.Http.HttpRequestException: CLEARTEXT communication not enabled for client Now. i saw on internet that, for Android, I have to add a network configuration with CLEARTEXT enabled, and i did it, without any result. What should i do to enable CLEARTEXT communication?

alexrainman commented 4 years ago

Use TLSConfig.DangerousAllowInsecureHTTPLoads property.

alexrainman commented 4 years ago

In iOS you have to add this to the info.plist

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>gorest.co.in</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>