0

Only on flutter in android all calls to my server throw the following error CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359))

From the mobile browser my site works, from the PC browser also, and also from the flutter web. Only from android it says certificate expired.

I have checked with SSL Checker and everything is setup correctly. Output of SSL Checker:

$MYDOMAIN resolves to $MYIP
    
Server Type: Caddy
    
The certificate should be trusted by all major web browsers (all the correct intermediate certificates are installed).
    
The certificate was issued by Let's Encrypt.
    
The certificate will expire in 79 days.     
    
The hostname ($MYDOMAIN) is correctly listed in the certificate.

Does anybody know how to fix this?

RailTracer
  • 101
  • 1
  • 7
  • We experience the same behaviour, though our certificate should be valid. I presume root certificate on older Android devices expired and now this is the aftermath. Did you solve this? Does this happen on all devices or just old ones? – simonescu Dec 06 '21 at 19:53
  • Also related: https://stackoverflow.com/questions/69872260/i-get-an-error-while-i-send-the-following-http-get-request-i-use-flutter-2-5 Did you check the system clock on failing devices? – simonescu Dec 06 '21 at 19:54

1 Answers1

0

just 2 step need for fix error

1.create cutom class extended

    class CustomHttpOverrides extends HttpOverrides{
  @override
  HttpClient createHttpClient(SecurityContext? context){
    return super.createHttpClient(context)
      ..badCertificateCallback = (X509Certificate cert, String host, int      port)=> true;
  }
}

2.add line to main function

HttpOverrides.global = CustomHttpOverrides();