Jaguar-dart / jaguar

Jaguar, a server framework built for speed, simplicity and extensible. ORM, Session, Authentication & Authorization, OAuth
http://jaguar-dart.github.io
463 stars 34 forks source link

Issue with SSL #151

Open GamePowerDev opened 3 years ago

GamePowerDev commented 3 years ago

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 commented 2 years ago

me too

tejainece commented 2 years ago

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