Jaguar-dart/jaguar

Issue with SSL

Opened this issue · 2 comments

Hello! so I've followed the guide for getting up SSL with jaguar (I'm using flutter with a headless webview). But I'm getting the following error when trying to access the URL:

"An SSL error has occurred and a secure connection to the server cannot be made."

Here's my current code snippet:

Future<void> _startServer() async {
    final cert = await rootBundle
        .load("assets/ssl/certificate.pem");
    final keys =
        await rootBundle.load("assets/ssl/keys.pem");
    final security = new SecurityContext()
      ..setTrustedCertificatesBytes(cert.buffer.asInt8List())
      ..usePrivateKeyBytes(keys.buffer.asInt8List());

    final server = Jaguar(securityContext: security);

    server.addRoute(serveFlutterAssets());

    await server.serve(logRequests: true);

    server.log.onRecord.listen((r) => print(r));
  }

@xiaocode337317439 There is an example here: https://github.com/jaguar-examples/https. It works for me. Can you try it?