Puma: HTTP parse error, malformed request

安稳与你 提交于 2019-12-12 03:37:54

问题


Firing up my local server with foreman and I get the following whenever I make any request.

HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"text/plain", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.9.1", "GATEWAY_INTERFACE"=>"CGI/1.2"}

Running Ruby 2.2.0 with rvm

And some potentially relevant bits from my Gemfile:

gem 'rails', '4.2.5.2'
gem 'puma', '2.9.1'

Completely stumped here and would appreciate any help. Happy to provide more context from my config, but I don't even know where to start.

Edit:

I get this error when I run the server with foreman start. If I fire it up with rails s then all is well.


回答1:


Make sure you're using http:// and not https://




回答2:


Not sure if you found the cause of this one, but the underlining issue seems to be with '%' characters in the url.

I tried upgrading to the latest version of Puma '3.4.0' but was still able to reproduce the error.

Hopefully that helps you to replicate your issue. Will update when I find a fix.



来源:https://stackoverflow.com/questions/36707585/puma-http-parse-error-malformed-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!