5

I've built a JSON API using Rails 3 and RABL

The API works well but on particular requests only part of the data is returned - the rest of the JSON is cut off. Since the JSON is therefore invalid, the mobile app which relies on the API is crashing.

Can anybody think of why the body is cut off at a certain size and point me in the right direction to resolve the issue? Thanks

bodacious
  • 6,608
  • 9
  • 45
  • 74
  • Is it always a 'max length' or is it cutting off based on the content contained in the response? If length, what length is it truncating after? – T C Aug 01 '12 at 22:15

1 Answers1

8

So I was able to track this issue down to Passenger

Long story short I fixed it by setting passenger_buffer_response off; in my passenger configs.

bodacious
  • 6,608
  • 9
  • 45
  • 74
  • Do you have any idea how to deal with it on Unicorn + Nginx? I came to exactly same problem in Unicorn but just can't figure out how to properly config it. Thank you! – yujingz Mar 17 '13 at 22:05
  • 6
    Add `proxy_buffering off;` to your location block http://unicorn.bogomips.org/examples/nginx.conf – bodacious Mar 18 '13 at 08:26
  • According to the comment by Hongli Lai (creator of passenger) this does not apply anymore as the bug got fixed. http://stackoverflow.com/questions/29241053/incomplete-response-received-from-application-from-nginx-passenger – Michał Szajbe Aug 13 '15 at 08:58