#1446·Robyn

Make original request object or original request headers available in websocketadapter

Author: klausmyrsethCreated Sep 15, 2026Updated Sep 16, 2026
Labelsenhancement

The why: I am doing a bit more enterpricy stuff where i actually have a proper security system that preauths the requests towards our IAM. The authentication information and routing information is stored in the original requests headers and its critical for me to authorize anything that goes on inside the websocket. It holds more then authentication, it holds even the original client ip and more information that i have to use actively for supporting GDPR and other security aspects that goes on everything from geofencing to whitelists/blacklisting, authorization and authentication.

To be completely secure i need this to be completely handled outside the websocket as we did when using our previous webserver that supports this, where we extended our protocol using Sec-WebSocket-Protocol so our security solution can add the needed data to the request that is passed on the the server. Antix support this by default so im supprised that Robyn dont have this exposed.

We could dump our security level and use auth packages inside the websocket but that makes me having to implement a full security system on my own with renewals and what not that is handled by the 3rd party security system already and is just a way to ask to get more security issues with my product.

Alternatives: Sanic, FastAPI, most rest apis for python. But none inside Robyn.

Ideas: Just add the headers from the request to the WebSocketAdapter and that would be the simplest model, but for a full featured one i guess you have to add some logic to the injection system so the original request can be injected by parameter name on the handler as it got a few other nifty data points. Sadly im not very traversed in Rust at the moment so im pretty sure I would just mess up the server if I contribute. I do really like the server and were trying to migrate away from some other servers because of the possibility to run freethreading and save us tons of headaches.