I'm trying to set a server-side event correctly to no avail.
I have a Django server that has a URL that sends sse, I can proxy easily with nginx with this simple conf:
Some more info to help debug the problem. The error I get in the application is "took too long to shut down and was killed." or precisely:
Application instance <Task pending name='Task-2' coro=<StaticFilesWrapper.__call__() running at /home/sandro/.pyenv/versions/3.8.6/envs/fiverr-traefik/lib/python3.8/site-packages/channels/staticfiles.py:44> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fe3092690d0>()]>> for connection <WebRequest at 0x7fe309b68640 method=GET uri=/adrenalinik/sse/channels/sse-example/ clientproto=HTTP/1.1> took too long to shut down and was killed.
Exception inside application: [Errno -3] Temporary failure in name resolution
Traceback (most recent call last):
File "/home/sandro/.pyenv/versions/3.8.6/envs/fiverr-traefik/lib/python3.8/site-packages/channels/generic/http.py", line 81, in http_request
await self.handle(b"".join(self.body))
File "/home/misc/src/hg/thunder/siti/adk/fiverr-traefik/apps/adrenalinik/consumers.py", line 71, in handle
await asyncio.sleep(4)
File "/home/sandro/.pyenv/versions/3.8.6/lib/python3.8/asyncio/tasks.py", line 656, in sleep
return await future
asyncio.exceptions.CancelledError
I guess "Temporary failure in name resolution" is a good candidate for the culprit, but I'm not able to make good profit of it. Rememnber: when passing via nginx it does work correctly.
I thought there were quite a lot of people using Server-Sent events and the fact that there's a compress option to cope with text/stream-data makes me think it's a well-supported setup.
I'd like at least to understand if others have managed to proxy server-sent events.
BTW: am I correct in thinking that if I don't use compress middleware, there's no compression at all and ideally it should work? ie: I only need the option that excludes compression if I explicitely set compression.
@sandroden: I am also highly interested in this. I tested SSE with Traefik v2 and it appears to work fine.
I don't know whether compression is enabled for this test.
SOLVED. It turns out I was sending 2 identical headers and that makes Traefik complain.
More explanation in the issue (that I couldn't comment as I realized when it was already frozen...)