-
Notifications
You must be signed in to change notification settings - Fork 303
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
Bug report — Rewriting a WebSocket response throws exception due to unsupported status code 101. #3047
Comments
As a work-around, you can change the status to 200 -- because it has a |
@kentonv Thanks for the quick response! I will try that, for now I'm using this minor patch on next-on-pages Do you know if it should be taken care in workerd by allowing status code 101, or by providing an api for handling special cases when response is being forwarded from other services like durable objects, or it should be taken care in next-on-pages and it is not going to be supported to instantiate a response with status code 101 in workerd? |
Supporting 1xx interim responses in workers is something we've discussed but is not trivial as it is something that would need to be implemented deep throughout our stack. I do want to make this happen but we'll need to discuss internally around priority and feasibility. I'm going to change this issue to a feature request as it's not really a bug as much as a limitation of the current design/implementation. |
@jasnell Thanks! That makes sense. So to wrap it up and avoid misinterpretation of this issue in the future, if I understand it correctly:
|
I've changed the title of this bug to better reflect the specific bug here. @jasnell the ask is NOT to support 1xx in general. The problem here is that This is a bug which we should fix. We should simply say that if the |
SGTM |
Thanks! This might help others with similar issues: My original challenge was serving the WebSocket endpoint on the same subdomain as my web application, which led me to try proxying responses. Even with a workaround to deal with the issue reported here, I ran into the issue of the connection closing after 100 seconds of inactivity due to hibernation (noted in the docs but a little easy to miss). Then, I discovered the routes feature, a handy tool that allows serving different workerd instances on different paths without needing to proxy WebSocket responses. |
If I try to instantiate a response based on another response, with status code 101, returned by a
DurableObject
, I get this error:Responses may only be constructed with status codes in the range 200 to 599, inclusive.
This is causing an issue in next-on-pages as reported here
I don't know if it should be addressed here, or next-on-pages should put an exception for this case to directly return the response coming from the
DurableObject
and return it without re-instantiation.The text was updated successfully, but these errors were encountered: