Getting SSL / https working locally for Rails with puma-dev
Asked Answered
F

3

5

puma-dev should work with https / SSL with just the initial install puma-dev -install when you visit https://yourlocalsitename.dev.

I can see the certificate in Chrome > Dev Tools > Security but it says

This page is not secure (broken HTTPS).

Certificate Error
There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).

How can I get puma-dev working in https locally?

Festinate answered 13/1, 2017 at 18:45 Comment(0)
F
11

If the normal puma-dev -install doesn't work even after brew uninstall/install of puma-dev try this recommended here

  1. In Chrome > Developer Tools > Security click View Certificate
  2. Drag the icon for the certificate to your OS X desktop
  3. From your desktop, double click on the cert to install it in your OS X > Keychain Access as System (not login)
  4. From Keychain Access, double click on the cert (in System) and change the dropdown to Always Trust

Now try visiting https://yourlocalsitename.dev again, but in a new tab, and it should be green for https.

Festinate answered 13/1, 2017 at 18:45 Comment(0)
S
4

this is the most recent method.

security add-trusted-cert -k login.keychain-db ~/Library/Application\ Support/io.puma.dev/cert.pem

https://github.com/puma/puma-dev/issues/84#issuecomment-269588573

Semivitreous answered 19/6, 2020 at 7:16 Comment(0)
C
0

In recent MacOS/X versions the drag-and-drop feature of the certificate doesn't work for Chrome:

  • Do openssl s_client -connect 127.0.0.1:443 -servername your.site.localhost -showcerts. Interrupt when the certificate data is displayed.
  • Create a file which content is the output of the previous command from the --- BEGIN CERTIFICATE line to the --- END CERTIFICATE line (including them).
  • Do sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain <certificate file>
  • Open Keychain Access application, find the certificate in the System Keychain and set the trust level to 'Always Trust'
Cardiac answered 27/2, 2019 at 23:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.