HTTPS Oak Deno
I want to run Deno Oak over Https in local. I use OpenSsl to create cert and key. But no works.
4 Replies
To run an Oak server over HTTPS in Deno, you'll need to use the
listenTls
function provided by Deno to create a secure server. The documentation indicates that you can now pass the certificate and private key directly as strings to Deno.listenTls()
, which is a more flexible approach than using file paths.
Here's a step-by-step guide based on the documentation:
1. Ensure you have your certificate (localhost.crt
) and private key (localhost.key
) ready. You mentioned you've created these using OpenSSL, which is the correct approach.
2. Read your certificate and key files into strings using Deno.readTextFile
. This is an asynchronous operation, so you'll need to await the results.
3. Use these strings to create a TLS listener with Deno.listenTls
.
Here's an example code snippet from the documentation that demonstrates how to do this:
Make sure to replace "path/to/localhost.crt"
and "path/to/localhost.key"
with the actual paths to your certificate and key files.
If you're still encountering issues, ensure that:
- The certificate and key are correctly formatted and match each other.
- The paths to the certificate and key files are correct.
- You have the necessary permissions to read the certificate and key files.
If you've followed these steps and are still facing problems, please provide more detailsabout the error messages or issues you're encountering, and I'll do my best to assist you further. 🦕
...
I want a person not a bot
I create with mkcert now and no validate certificate