SSL Certificates
This guide has an example repo:
examples/https-ssl-certificates
npm start -- --secure
Snowpack provides an easy way to use a local HTTPS server during development through the use of the --secure
flag. When enabled, Snowpack will look for a snowpack.key
and snowpack.crt
file in the root directory and use that to create an HTTPS server with HTTP2 support enabled.
Generating SSL Certificates
You can automatically generate credentials for your project via either:
- devcert (no install required):
npx devcert-cli generate localhost
- mkcert (install required):
mkcert -install && mkcert -key-file snowpack.key -cert-file snowpack.crt localhost
In most situations you should add personally generated certificate files (snowpack.key
and snowpack.crt
) to your .gitignore
file.