nginx passenger recv() failed (104: Connection reset by peer) while sending to client

229 Views Asked by At

I'm posting some json to a Sinatra post route on nginx. I'm getting a 500 ISE error. I don't know why this is happening.

The JSON is good, the url is valid (showing 404 when pulled up in a browser, as expected (it's set to throw 404 with no JSON).

url = URI.parse('https://example.com/t_test')
# http = Net::HTTP.new(url.host, url.port)
http = Net::HTTP.new(url.host, 443)
http.use_ssl = true if url.scheme == 'https'
request = Net::HTTP::Post.new(url.path, {
  'Content-Type' => 'application/json'
})
request.body = json_data
response = http.request(request)

puts "Response Code: #{response.code}", ''
puts "Response Body: #{response.body}"
recv() failed (104: Connection reset by peer) while sending to client

What is happening, and how can I fix this?

1

There are 1 best solutions below

0
Rich_F On

That request route had instructions to write to a file. That was creating the ISE. I wrote a method inside the helper block that cleared it up.