Unable get HttpOnly, Secure cookie coming from client in the connect
event handler ?
#1192
Replies: 4 comments 4 replies
-
I think you misunderstand the role that the python-socketio package plays in your stack. Handling of cookies is entirely the business of your client and your web server, so this package has nothing that can prevent cookies from being passed. The It appears you are filing this bug on behalf of someone, since you say that "they claim" that the cookie is in the request. My recommendation is that confirm this, because the most likely reason for the cookie to be missing is that the browser isn't sending it. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. I checked with the UI team , they mentioned the cookies are part of the request headers and since its HttpOnly it can't be accessed on the client side and to ensure that they shared the request headers from the developer console. As you mentioned that this has nothing to do with the python-socketio, is there a way to figure out if the cookie is reaching the server or where is it getting eaten up , I am new to this, so any help would be great ? |
Beta Was this translation helpful? Give feedback.
-
Hi @miguelgrinberg , In order to test this locally, I created simple server, below is the code:
Here I am creating two http endpoints:
So does that mean the cookie is not shared across HTTP and socketio session ? If so how should I access it ? |
Beta Was this translation helpful? Give feedback.
-
Thanks @miguelgrinberg , So you think this could be a problem with Sanic not passing the cookie after HTTP handshake and upgrading to websockets, because within HTTP session I am able to see the cookie received at the server and also if I explicitly add the Cookie in the header of the socketio request, I can still see the cookie in the If you can share any other framework apart from Sanic that can be used to achieve the same, it would be really helpful. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a rasa open-source server running which uses python-socketio to implement event handlers. It uses sanic Blueprint and routes socketio connections to it. I am customizing its socketio implementation to have an authentication mechanism in place during the connect event. The authentication happens through the JWT token present in the cookie, but when I try to print
environ
dictionary there is no HTTP_COOKIE attribute part of it although the cookie becomes part of the header while making a connection request. The client is not explicitly adding cookie to the header while calling theconnect
event since the cookie is httponly and secure, but they claim that it automatically gets added by the browser. So I am trying to understand weather the cookie even reaches my server or not and ifenviron
is the way to access this cookie ?P.S: The rasa server is running behind the nginx reverse proxy.
Rasa Socketio implementation: https://github.com/RasaHQ/rasa/blob/main/rasa/core/channels/socketio.py
Any help is appreciated, thanks.
Beta Was this translation helpful? Give feedback.
All reactions