django-revproxy icon indicating copy to clipboard operation
django-revproxy copied to clipboard

Websocket Proxying Support (Django Channels)

Open Archmonger opened this issue 4 years ago • 5 comments
trafficstars

Would be fantastic if WS proxying was supported, as many Django users have been moving to ASGI webservers.

See these examples for functional implementations that need to be made generic enough to use within django-revproxy:

  • https://gist.github.com/brianglass/e3184341afe63ed348144753ee62dce5
  • https://github.com/django/channels/discussions/1755#discussioncomment-6360755

Archmonger avatar Feb 02 '21 23:02 Archmonger

I'm having a difficult time trying to adapt RevProxy to async. My architecture has Django as the entrypoint into my services to leverage Django's auth and security practices. I proxy my requests to the various services and I am unable to use async and deferments of underlying services because of this. In essence I have created my own GIL :(

My approach has been trying to replace urlib3 with httpx but I get hung up with streaming responses. It would be wonderful if someone more knowledgeable could create working PR!

ZipBrandon avatar Feb 06 '23 18:02 ZipBrandon

Seems like two people accomplished this with minimal LOCS:

  • https://github.com/django/channels/discussions/1755#discussioncomment-6360755
  • https://gist.github.com/brianglass/e3184341afe63ed348144753ee62dce5

Archmonger avatar Jul 09 '23 09:07 Archmonger

Here's a non-django ASGI generic of websocket reverse proxies: https://github.com/valohai/asgiproxy

Archmonger avatar Jul 30 '23 02:07 Archmonger

Is there a way we can fundraise through @jazzband to get some help here?! Thanks!

shicholas avatar Feb 21 '24 15:02 shicholas