basecamp / kamal-proxy

Lightweight proxy server for Kamal
https://kamal-deploy.org/
MIT License
751 stars 31 forks source link

SSEs are blocked when behind kamal-proxy #46

Closed ezynda3 closed 1 month ago

ezynda3 commented 1 month ago

I recently deployed an app using Pocketbase (https://pocketbase.io) as the framework. It works with a front end JS library and has some great realtime features that use SSEs. OAuth login also uses SSEs. I added login to my app and as part of the process it calls a route that uses SSEs and it simply hangs forever until the entire process times out. The same flow works just fine on my local machine.

I have a feeling the issue could be similar to this issue here https://github.com/pocketbase/pocketbase/discussions/5593

The thing is I don't see anywhere where I can configure compression for kamal-proxy.

kevinmcconnell commented 1 month ago

@ezynda3 we just shipped a fix for this in the proxy (#36). There will be a new Kamal release shortly that includes this proxy version. It's actually not about compression in this case, but rather that the SSE responses were being buffered in the proxy, preventing the client from seeing the events in real time.

If you can upgrade to the latest Kamal once it comes out, you should find it's then working properly.

I'll close this as I believe it's the same as #34, but if you continue to have a problem with it after upgrading please let me know!

ezynda3 commented 1 month ago

Awesome. Thanks a lot!

ezynda3 commented 1 month ago

Quick question. Is it possible to use the latest kamal-proxy manually without waiting for a new kamal release?

kevinmcconnell commented 1 month ago

At the moment Kamal is pinned to an exact version of the proxy, so there's not really a way to advance one without the other, unfortunately. This pinning has been useful while both have been in rapid development. We'll add an override for this soon, so that you'll be able to opt in to a different proxy version if you want. But that override is not in Kamal currently.

I think we'll ship a new Kamal release today or tomorrow though, so at least in this case you shouldn't have to wait much longer for the fix!

kevinmcconnell commented 1 month ago

@ezynda3 just fyi, the new Kamal release has shipped, so you should now be able to update and get the SSE fix.