puma: Puma should provide a better error message when attempting to open an SSL connection to a non-SSL puma

2016-05-29 10:55:33 +0530: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
2016-05-29 10:55:33 +0530: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"3.1.0", "GATEWAY_INTERFACE"=>"CGI/1.2", "REQ
UEST_METHOD"=>"GET", "REQUEST_PATH"=>"/selections.js"}

---

rails 4.2 puma latest version

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 11
  • Comments: 31 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I have the same when I open https:// instead http://. E.g. https://localhost:3000/ instead http://localhost:3000/.

This is super common in dev environments where sometimes people have a project on port 3000 which uses SSL, and then they switch to one that doesn’t and the browser tries an SSL connection.

@nicolasmlv I think you have to clear out Chrome’s HSTS cache. chrome://net-internals/#hsts

Changing to docs/feature to reflect that this issue remains open for providing better/more informative error messages here (“hey, this looks like SSL but I’m not accepting SSL connections!”)

I’m currently working on this, hopefully it will be included in Puma 6.5.0. It’s messy, explanation will be included with the PR.

I am seeing this error in tests, but Capybara is configured to use http:// not https, so I dont understand.

@phantomwhale We are also seeing this error in production. We are running on AWS with the SSL termination happening on ELB, so only HTTP requests should be sent to Puma. Nothing is obviously broken, but every so often (once or twice a day) we get this error logged which triggers our alerting system. Did you figure out the cause in your case?

I’m seeing these errors constantly in production - running on port 80 (in ECS / Fargate behind an ALB - although doubt that should change anything)

It’s been throwing these errors for a long time now (months, years maybe), but all the searches on the error seems to be around the localhost / local development issue. Is there a scenario where this might come up in production? And is there a way of unpacking what requests to puma are causing the error?

I don’t know if anyone else might have this issue, but mine was related to passing in the wrong address wss://localhost:3000/cablesecure instead of ws://localhost:3000/cableunsecure