nchan
nchan copied to clipboard
EventSource is not functioning when using http2
Subscriber connections to EventSource are unexpectedly closed when http2 protocol is used.
Nginx logs
2020/06/13 10:07:48 [error] 6#6: *1 output on closed stream, client: 172.17.0.1, server: localhost, request: "GET /subscribe/ HTTP/2.0", host: "localhost:3006"
172.17.0.1 - - [13/Jun/2020:10:07:48 +0000] "GET /subscribe/ HTTP/2.0" 400 0 "-" "curl/7.52.1" "-"
I've build docker environment for reproducing this behaviour and wrote detailed description here: https://github.com/Peter-Sh/nchan-eventsource-http2-issue
Thanks for the detailed report, I'm looking into this.
Hi, just a word to say I have no problem with HTTP2. My subscribers successfully receive server-sent events (nchan 1.2.7).
I have the same issue. Both with nginx 1.18 and 1.19.
It also sometimes logs MEMSTORE:01: tried adding WAITING chanhead 000055EB98902400 general/broadcast to chanhead_gc. why?
More info:
The server responds with a 204 No Content response, but a 400 response is logged.
With nginx 1.16.1 it is also broken. With nginx 1.14.2 it works. So I guess this is a regression. I read somewhere that nchan uses 204 responses to make nginx keep the connection alive. Maybe they changed how this works?