-
Notifications
You must be signed in to change notification settings - Fork 222
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
How to use ws4redis in a separate URL address? #184
Comments
I'm not sure if this restriction applies to websockets as well, but Javascript sometimes applies a foreign origin policy. |
No, it does not apply to websockets. =/ During my tests, I needed to modify the following line in order to change the websocket host: Could this have an impact on the way messages are consumed from redis queue? |
Just found the problem. It concerned with looking for session key in line https://github.com/jrief/django-websocket-redis/blob/master/ws4redis/wsgi_server.py#L54. In the case of cross domains (websocket domain != app domain), it is necessary to inform Django to use the same cookie for these domains, setting the variable SESSION_COOKIE_DOMAIN in settings.py. For instance: SESSION_COOKIE_DOMAIN = '.myapp.co'. For more information, please refer to http://www.pindi.us/blog/migrating-cross-domain-cookies-django. However, I needed to perform some minor modifications in ws4redis context_processor and settings in order to make it work with cross domains. I intend to do a pull request soon. |
This is fixed by pull request #185 |
I use a proxy service (CloudFlare) that does not support websockets. A workaround is to have a separate address for the websockets (such as ws.myapp.com), that is not behind the proxy. I tested this configuration and noticed that ws4redis was able to connect and send messages to the server, however the messages from the server were not flowing back to the clients. No errors showed up.
Do you have any clue on this? What part of the code should I look for if it is necessary some modification?
Thanks.
The text was updated successfully, but these errors were encountered: