nginx_push_stream module and X-Accel-Redirect, nginx sub-request issue?

Maxim Dounin mdounin at mdounin.ru
Mon Jul 4 01:56:19 MSD 2011


Hello!

On Tue, Jun 21, 2011 at 11:48:59AM +1000, Robert Mueller wrote:

> Hi
> 
> I'm trying to use the nginx push stream module here:
> 
> https://github.com/wandenberg/nginx-push-stream-module/
> 
> The general flow is that the client connects to https://server/events/,
> which internally does some auth checks on the connection, and then does
> X-Accel-Redirect to to https://server/sub?id=*channelname* to connect
> the push channel to the user.
> 
> Unfortunately nginx closes the connection after 5 seconds. I asked the
> module author about this, and he mentioned that he had already seen the
> issue, but it's related to an internal nginx code design with sub
> requests which he talks about here:
> 
> https://groups.google.com/group/nginxpushstream/msg/577fe1ffe636da75
> 
> Not being an expert on the code, I'm not sure where the issue is, but
> was hoping to connect people so it can be resolved :)

(in case it's still intresting)

This looks like the problem in push stream module from here.  It 
incorrectly set r->discard_body by hand[1] instead of using 
ngx_http_discard_request_body() function, and this causes 
lingering to be activated and close connection as long as there 
are no data from client within lingering_timeout (5s by default).

[1] https://github.com/wandenberg/nginx-push-stream-module/blob/master/src/ngx_http_push_stream_module_subscriber.c#L145

Maxim Dounin



More information about the nginx mailing list