boolean | { key: string; cert: string }
false
After configuring this option, you can enable HTTPS Dev Server, and disabling the HTTP Dev Server.
HTTP:
HTTPS:
You can directly set https
to true
, Modern.js will automatically generate the HTTPS certificate based on devcert.
When using this method, you need to manually install the devcert dependency in your project:
Then configure dev.https
to true
:
The devcert has some limitations, it does not currently support IP addresses yet.
The https proxy automatically installs the certificate and needs root authority, please enter the password according to the prompt.The password is only used to trust the certificate, and will not be leaked or be used elsewhere.
You can also manually pass in the certificate and the private key required in the dev.https
option. This parameter will be directly passed to the createServer method of the https module in Node.js.
For details, please refer to https.createServer.
The certificate created by devcert is saved in ~/Library/Application\ Support/devcert
. You may do some cleanup if needed.