-
Notifications
You must be signed in to change notification settings - Fork 88
How to get the "green padlock" using the built in certificate
Tested on Chrome on macOS. Feel free to add instructions to this page for Windows, Linux or other browsers.
Possible locations:
- local-web-server is installed globally
-
/usr/local/lib/node_modules/local-web-server/node_modules/lws/ssl/lws-cert.pem
on macOS and Linux. -
%AppData%\npm\node_modules
on Windows 7+
-
- local-web-server is installed locally
./node_modules/lws/ssl/lws-cert.pem
If you're using nvm
, your installation directory may be different.
$ nvm which current
-
$ open
that directory - Follow back that directory until you get to your active version directory (
v#.##.#
) - Go to
./lib/node_modules/local-web-server/node_modules/lws/ssl
If you're using the default NVM install location, you can also just run:
$ open ~/.nvm/versions/node/v8.11.1/lib/node_modules/local-web-server/node_modules/lws/ssl/
You must add the new certificate to your machine's trusted certificate store. On macOS, this is done via the Keychain Assistant.
- Open Keychain Assistant
- Import the certificate
- Open it and select "Always trust"
Follow the instructions at https://leehblue.com/add-self-signed-ssl-google-chrome-ubuntu-16-04/ to trust a certificate on Ubuntu
Follow the instructions at http://www.nullalo.com/en/chrome-how-to-install-self-signed-ssl-certificates/ tl;dr:
- Start your local web server in https mode and browse to the site
- Click
Advanced > Proceed to localhost (unsafe)
- Press F12 to open dev tools
- Click on the security tab, then click on
View Certificate
- Click the details tab then
Copy to File
- Click "Next", then
Cryptographic Message Syntax Standard – PKCS #7 Certificates (.P7B)
, then "Next" again - Save the certificate somewhere accessible, like the Desktop
- Open
Chrome Settings
>Show advanced settings…
>HTTPS/SSL
>Manage certificates…
>Import
- Click "Next", browse to the certificate you exported in step 7.
- Click "Place all certificates in the following store", then click "Browse" and select
Trusted Root Certification Authorities
. - Click "OK", then "Next", then "Finish"
- Restart Chrome
$ ws --https
Serving at https://mbp.local:8000, https://127.0.0.1:8000, https://192.168.0.100:8000
If you navigate to https://127.0.0.1:8000
you will now see the green lock.