strongloop / strong-remoting

Communicate between objects in servers, mobile apps, and other servers.
www.strongloop.com
Other
105 stars 93 forks source link

Compression middleware breaks `EventSource` requests #234

Closed ritch closed 8 years ago

ritch commented 9 years ago

I believe this is the cause of :ERR_INCOMPLETE_CHUNKED_ENCODING errors.

Upgrading the version of event-stream might fix this.

fabien commented 8 years ago

Yes, this is the cause - a good workaround would be:

function compressFilter(req, res) {
    var accept = req.headers['accept'] || '';
    if (accept.indexOf('text/event-stream') > -1) return false;
    return compression.filter(req, res);
};

app.middleware('initial', compression({ filter: compressFilter }));

Hasn't this been fixed already? I haven't used your event-stream implementation, but I have been doing something similar and had the same issue.

richardpringle commented 8 years ago

@0candy, did you have an issue concerning streams and compression?

I assigned you for now, please re-assign to me upon response.

0candy commented 8 years ago

@richardpringle This https://github.com/strongloop/strong-remoting/pull/294 should fix the issue. We set to no compression when using event stream.

richardpringle commented 8 years ago

@0candy thanks, closing.