Quickly serve a html document via https

2024-02-29

I just needed to quickly serve a simple html document on a remote machine.

Usually I would go for npx serve in the directory where the .html file resides. But serve does not support https, so I found this fork of vercels serve package: https://github.com/warren-bank/node-serve

Just hit npx @warren-bank/serve --ssl

If no certificate is provided, you’ll need to do the “this page is insecure but I still want to see it” dance in your browser, but that was enough for my use case (just needed a “secure context” to use secure browser APIs)

Optionally, you can provide a real certificate/key/passphrase as described in the docs.