Hi,

As I remember, such error occurs than you send data before headers (or 
don't send headers at all). There is two possible ways to solve it:
1) try to send some headers from your code prior to streaming
2) stream thru Nginx itself, there is no reason to pass it to CB if file 
exists on filesystem

p.s. upgrade your CB to latest and you will have all latest versions of 
deps too

On Sunday, March 9, 2014 2:47:30 AM UTC+2, Tomas Morstein wrote:
>
> Hello,
>
> Is anybody using streaming actions behind the Nginx proxy?
>
> Let's say we have the following action:
>
> stream_test ('GET', [], _) ->
>     StreamGen = fun
>                     ({N, Max}) when N < Max ->
>                         {output,
>                          list_to_binary ([ <<($A+(N rem ($Z-$A)))>>
>                                            || _ <- lists:seq (1, Max) ]),
>                          {N+1, Max}};
>                     (_) ->
>                         done
>                 end,
>     {stream, StreamGen, {0, 64}}.
>
> And just a "proxy_pass" rule on the Nginx side.
>
> If I call the "stream_test" action directly, everything works fine. If I 
> try to call it via Nginx proxy, I get the error:
>   upstream prematurely closed connection while reading response header 
> from upstream
>
> I have tried everything about the proxy buffer sizes, tried to toggle 
> buffering at all, tweaked most of the timeout options available, but none 
> of the mentioned helped.
> (My tests are based on CB 0.8.7. Also tried to manually upgrade 
> ranch+cowboy to their latest versions. Didn't help.)
>
> Any ideas?
>
> Tom
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/e6ceee10-2711-4353-b28f-614e5a37ca70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to