Skip to main content

change-ssl-ceritificates-on-localhost

Step 1: Generate key & crt files using this cmd command:

name=${fileName} openssl req \ -new \ -newkey rsa:2048 \ -sha256 \ -days 3650 \ -nodes \ -x509 \ -keyout $name.key \ -out $name.crt \ -config <(cat <<-EOF [req] distinguished_name = req_distinguished_name x509_extensions = v3_req prompt = no [req_distinguished_name] CN = $name [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth subjectAltName = @alt_names [alt_names] DNS.1 = $name DNS.2 = *.$name EOF )

Step 2: Trust the certificate:

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${fileName}.crt

Notice: works only for macOS

Step 3: Configure local server:

in Procfile.dev file uncomment and update this command:

web: thin start -p 3000 --ssl --ssl-key-file ${pathToFile/fileName}.key --ssl-cert-file ${pathToFile/fileName}.crt --ssl-disable-verify

Step 4: Run ur local env and verify that it's working

Otherwise, we can sync and I can help u to install it!