mathworks / matlab-proxy

Python® package enables you to open a MATLAB® desktop in a web browser tab.
Other
48 stars 23 forks source link

WebSocket handshake should be case insensitive #9

Closed maben-mw closed 2 years ago

maben-mw commented 2 years ago

While all supported browsers do appear to use Connection: Upgrade with capital U and Upgrade: websocket with all lower case "websocket", and so the case-sensitive matches to Upgrade and websocket in app.py:

https://github.com/mathworks/matlab-proxy/blob/45276dcec6a809b99f903ed7c86f70f0bc19a2c0/matlab_proxy/app.py#L374-L378

will work fine in most cases, according to RFC6455 these values should be ASCII case-insensitive matches.

This does in fact lead to issues in practice when using matlab_proxy behind a reverse proxy where the reverse proxy may have rewritten Upgrade as upgrade (e.g. if you literally configured NGINX according to the instructions on https://nginx.org/en/docs/http/websocket.html). Of course the configuration can be changed such that the reverse proxy outputs Upgrade as well, but that should not be needed according to the RFC spec.

prabhakk-mw commented 2 years ago

@maben-mw Thank you for the detailed report and explanation. We will include these suggestions in the next release.