Unable to parse TLS packet header

2024-03-04T09:38:23.7166667+00:00

i just upgrade my xamarin project to maui and i have an httpclient error Unable to parse TLS packet header when i try to comunicate with my api

HttpClient httpClient = new HttpClient();

response = await httpClient.SendAsync(msg, cts.Token);

sendasync throws Unable to parse TLS packet header

I tried to fix it from androidmanifest with android:usesCleartextTraffic="true" and network_security_config and didnt help

Developer technologies | .NET | .NET MAUI
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-04-12T16:09:27.1666667+00:00

    with android (unlike windows) code can not override ssl verification. also http is not supported by default for api calls. see:

    https://developer.android.com/privacy-and-security/security-config#TrustingAdditionalCas

    note: you can also install and trust the self signed certificate on the device. google for examples

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.