Open armstrongch1994 opened 5 years ago
I'm having the exact same issue. I understand this was posted a couple of years ago now, but is there any chance you remember what the fix was?
@Nathan-BrokenFaders @armstrongch1994
Here's a snippet from the docs I created for our Groupthought themes internal process which is slate-adjacent.
To create a localhost ssl cert for browsersync use this command
test ! -d ~/.localhost_ssl && mkdir ~/.localhost_ssl
openssl req -x509 -days 1095 -out ~/.localhost_ssl/localhost.crt -keyout ~/.localhost_ssl/localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
this will create a localhost cert folder at ~/.localhost_ssl/ with a cert and a key. You may need to manually add that cert to keychain and set trust -> ssl -> always
open ~/.localhost_ssl/localhost.crt
Click on 'Add' to add the cert to keychain
Right click that localhost cert you just created and added to keychain, and use Get info
to adjust the preferences.
Expand the trust
tab and change the Secure Socets Layer (SSL)
dropdown to Always trust
I don't use this version of slate but if you might have better luck with a hardcoded key location. Slate loads the SSL keys into browsersync here: https://github.com/Shopify/slate/blob/5ecc510efed9a14fa9e3954c1adedeac91650144/packages/slate-tools/tools/dev-server/index.js#L39
I think you'll also have to set an SSL location in the config file: https://github.com/Shopify/slate/blob/5ecc510efed9a14fa9e3954c1adedeac91650144/packages/slate-tools/slate-tools.schema.js#L58
If you want to use that default config you'll need to call the key and cert server
which would look like this:
test ! -d ~/.localhost_ssl && mkdir ~/.localhost_ssl
openssl req -x509 -days 1095 -out ~/.localhost_ssl/server.crt -keyout ~/.localhost_ssl/server.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
Or you can just change the filename after you generate it.
Not 100% sure any of this will work since I am using a different version of browsersync and a completely different build process but this should set you down the right path.
This repo is currently on low maintenance. See README for details
Problem
Im on a mac and my ssl certificate is either not getting created or it is not being found when the ssl script is trying to move it. I keep getting ' no such file or directory.' I tried using my own ip address in the script also and that didnt fix anything.
Succinct outline of the problem or request.
brew install mkcert
in my terminalError in console after running script