You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the "Litestar" package to host a python API using Nginx Unit.
During development I used Litestar's recommended dev server "uvicorn" and did not experience any issues until I deployed to production running Nginx Unit and then got the error "405: Method Not Allowed" when I tried to make my websocket connections.
Tracing the issue, I found that the method being sent on the websocket connection was set to "GET" and the way Litestar handles determining if it's a websocket connection is based on the method being "None" so the fact that Nginx Unit is sending "GET" for the request is breaking it.
When I check the websocket spec, page 17, point 2 it says
"The method of the request MUST be GET, and the HTTP version MUST be at least 1.1."
So I initially thought Litestar was the problem and filed an issue over there.
The Litestar maintainers advised that the ASGI spec does not include a "method" key and so it would in theory be against the ASGI spec for Nginx Unit to be sending it.
I'm using the "Litestar" package to host a python API using Nginx Unit.
During development I used Litestar's recommended dev server "uvicorn" and did not experience any issues until I deployed to production running Nginx Unit and then got the error "405: Method Not Allowed" when I tried to make my websocket connections.
Tracing the issue, I found that the method being sent on the websocket connection was set to "GET" and the way Litestar handles determining if it's a websocket connection is based on the method being "None" so the fact that Nginx Unit is sending "GET" for the request is breaking it.
When I check the websocket spec, page 17, point 2 it says
"The method of the request MUST be GET, and the HTTP version MUST be at least 1.1."
So I initially thought Litestar was the problem and filed an issue over there.
The Litestar maintainers advised that the ASGI spec does not include a "method" key and so it would in theory be against the ASGI spec for Nginx Unit to be sending it.
I have a more detailed writeup over on the Litestar github here
I also made a git repo that allows you to reproduce the problem here: https://github.com/FixFlare/bug_3887
If I can clarify anything about the repo or the issue please let me know.
Thanks,
The text was updated successfully, but these errors were encountered: