Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local SSL with Ruby / Puma

I'm running a local puma server and I can't get resources to load under SSL.

I have a local signed cert.

I'm trying to run the server with the following config:

puma -b 'ssl://127.0.0.1:9292?key=/path/to/certs/localhost.unecrypted.key&cert=/path/to/certs/localhost.crt'

Now, when I visit https://localhost:9292 or https://127.0.0.1:9292, the browser just spins and there isn't a response from the server. No resources are returned. Twice it has shown me the HTML title tag, but almost always I get nothing.

Any idea? Other ideas? Really need to run a https version of this app locally and I can't figure out how to do it.

Edit: The inital request is logged, but there is no response:

127.0.0.1 - - [04/Sep/2013 11:29:15] "GET / HTTP/1.1" 200 1265 0.0397

Sometimes I will get this error:

013-09-04 11:30:20 -0400: Read error: #<Errno::EPIPE: Broken pipe>
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/minissl.rb:56:in `write'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/minissl.rb:56:in `write'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/server.rb:635:in `fast_write'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/server.rb:484:in `handle_request'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/server.rb:248:in `process_client'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/server.rb:147:in `block in run'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/thread_pool.rb:92:in `call'
/Users/wesbos/.rvm/gems/ruby-1.9.3-p429@sinatra/gems/puma-2.3.2/lib/puma/thread_pool.rb:92:in `block in spawn_thread'
like image 859
wesbos Avatar asked Sep 04 '13 15:09

wesbos


People also ask

Can I add SSL to localhost?

Steps to followSign an SSL certificate for localhost. Develop a server using Node. js that is being served up using a localhost SSL certificate. Configure the Firefox web browser and the Postman API client to allow certificates that we have signed as the CA.

What does SSL do?

An SSL certificate is a bit of code on your web server that provides security for online communications. When a web browser contacts your secured website, the SSL certificate enables an encrypted connection. It's kind of like sealing a letter in an envelope before sending it through the mail.


1 Answers

Turns out Puma has problems with SSL right now:

https://github.com/puma/puma/issues/350

Reverting to version 1.6.3 fixed it for me

like image 146
wesbos Avatar answered Sep 27 '22 22:09

wesbos