Sometimes the need arises for SSL in local development. We have guides for different webservers, this one is for puma.
make sure mkcert is installed
create an SSL certificate for localhost with mkcert:
$ mkcert-v1.4.4-linux-amd64 localhost
Created a new local CA 💥
...
config/puma.rb
:localhost_key = "#{File.join('localhost-key.pem')}"
localhost_crt = "#{File.join('localhost.pem')}"
ssl_bind '0.0.0.0', 3000, {
key: localhost_key,
cert: localhost_crt,
verify_mode: 'none'
}
https://localhost:3000
bundle exec rails s