-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server sent events does not work with proxy #1412
Comments
I've noticed that in response headers |
It works with But then it disables timeouts for the entire block. Anyway to only disable timeouts for a certain URL while still proxying to the same service? Maybe caddy could disable timeouts if upstream sends the header |
Go lets us set timeouts for the HTTP server, not per-request. So this is not a bug, you just have to choose a decent timeout. Disabling them honestly isn't all that bad, just re-enable them if you find yourself being slowlorised. But the number of people who are using Caddy to do advanced things like proxying SSE are fewer I'd suspect than the number of people who are simply using Caddy to serve static files. |
Well, it's almost trivially true that the number of people who use SSE are less than the total number of users! :) But then again, the front page says "Serve the web like it's 2017", and I think that means HTTP/2 and some kind of server push, and SSE is likely the best solution when you have HTTP/2. Of course you can disable timeouts, but in the documentation it states that you shouldn't:
In our case, we need the timeout for non-SSE, so we have something behind Caddy to reintroduce a timeout, but this complicates the setup, so it would be nice with support for this. Just my 👍 |
@Ahnfelt I'd like it too, but there was this go bug: golang/go#16450 and now this one: golang/go#18437 - which might be stepping on your toes a bit here. Also golang/go#16100 would be nice, but ultimately we're at the mercy of the Go standard lib here. For now, in your case, you'll have to disable the timeouts and then hope for the best. Sorry! |
1. What version of Caddy are you running (
caddy -version
)?Caddy (untracked dev build)
2. What are you trying to do?
Make webpack auto reload functionality work which uses SSE
3. What is your entire Caddyfile?
4. How did you run Caddy (give the full command and describe the execution environment)?
caddy
5. What did you expect to see?
SSE endpoint to continue sending events
6. What did you see instead (give full error messages and/or log)?
Connection breaks after about 30s with the following error on chrome:
net::ERR_INCOMPLETE_CHUNKED_ENCODING
7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?
Proxy the following with above
Caddyfile
https://github.com/kljensen/golang-html5-sse-example
Check connections being made. It should terminate the connection after 25s - 35s and open a new connection to event stream
Also, I've compiled caddy with
go version go1.8rc3 linux/amd64
because of #1355The text was updated successfully, but these errors were encountered: