Rober
Rober

Reputation: 6108

Puma server log error

I have an AngularJS web application sending requests to a Rails API running in a Puma server.

I see this error in my puma error log once or twice a day:

2015-02-26 23:26:41 +0000: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
2015-02-26 23:26:41 +0000: ENV: {"rack.version"=>[1, 2], "rack.errors"=>#<File:/home/ubuntu/env/production/www/yanpyapi/log/puma.stderr.log>, "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.10.1", "GATEWAY_INTERFACE"=>"CGI/1.2"}

I guess I have something wrong in my code. Not sure. Any way to identify where?

Upvotes: 0

Views: 2920

Answers (2)

Alex
Alex

Reputation: 136

it could be that you use somewhere ssl. in my example I used http://host.com(unsecure) and wss(secure) and it gave me that error. when they both match there is no error. so change it to http and ws or https and wss. Hope this is your case.

Upvotes: 4

Maxim
Maxim

Reputation: 9981

Any way to identify where?

Fork puma repository and add additional logging to methods called parse_error (try to log all request body). Use this way you can find request which caused your problem and investigate it.

Upvotes: 1

Related Questions