Mac – https (ssl secured) local websites are not working in Safari and Chrome in Mac Yosemite. How to fix this

google-chromemacsafarissl

As a developer, I will be running and testing the web apps that I am developing locally. But Chrome and Safari are not allowing me to hit my local server with SSL enabled.

https://localhost:8443/ is not working saying SSL error with the following error message. I think, it is something to do with adding my certificate to OS X Keychain Access, but I couldn't figure what actually needs to be done!

Could some one please help me out!

SSL connection error Hide details Unable to make a secure connection
to the server. This may be a problem with the server, or it may be
requiring a client authentication certificate that you don't have.
Error code: ERR_SSL_PROTOCOL_ERROR

Update

I was generating the self signed SSL keystore and certificate using the below command

keytool -genkey -alias tomcat -keyalg RSA -sigalg SHA256withRSA -keystore /path/to/keystore -keysize 2048 -validity 365

My problem got resolved, when I generated my self signed certificate with below simple command.

keytool -genkey -alias tomcat -keyalg RSA -keystore /path/to/keystore

I am not sure why!?

Best Answer

It's likely that the issue is with certificates for your server. You probably don't have a SSL certificate for localhost:8443 (as it's unlikely that any CA is going to issue one for that hostname), so of course you're going to get certificate errors. Either click through the certificate errors; or choose a valid domain that you control, get a certificate for it, and host your site on that domain.

If you have a certificate for your domain (example.com) and you have a SSL certificate for that domain (e.g., for www.example.com), another thing you could try is setting up DNS (or your /etc/hosts file) so that www.example.com resolves localhost (127.0.0.1). This still might run into other issues, and really, it's better to just test it on the domain you have a certificate for or click through the certificate errors.

None of this is likely to be Mac OS X specific.