-
Notifications
You must be signed in to change notification settings - Fork 44
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
Default value of check_request #85
Comments
The default value of The default value is of The real problem seems to be that we raise when the header checks fail. I don't think we should fail and call
Shouldn't the proxy forward headers? Note that |
Definitely agree. Sorry that you took time debugging @zoggy . I think we should stop raising an exception on client error, this does not make sense I probably coded this a long time ago and never made this part of the code evolve. I'm quite ashamed of this actually. I'll fix this soon, thanks. |
@vbmithr No problem. We can't focus on everything at the same time, then we forget :) @copy I agree that Regarding the By now, I provide as |
The JavaScript API in browsers doesn't let you override the Origin, so our default enforces the same-origin policy. It was inspired by a Go websocket implementation: https://godoc.org/github.com/gorilla/websocket#hdr-Origin_Considerations
This sounds useful, care to make a PR? |
Indeed the javascript API prevents setting the origin but I can still use Curl of any other library or tool to send any headers and pass the checks. Here is a patch to add |
Since release 2.7
Websocket_lwt.establish_server
has acheck_request
parameter. This is good, except that it has a default value:check_origin_with_host
. This is problematic when the server is behind a WS proxy because this control will fail and the resulting exception does not give a lot of information (so it took me some time to find it).Moreover, since the
on_exc
parameter has no default handler, the exceptionProtocol_error "Bad headers"
was raised and just shut down the websocker server.So I would suggest: either
check_request
andon_exc
orcheck_origin_with_host
default but in this case set a more informative error message and set a defaulton_exc
handler.The text was updated successfully, but these errors were encountered: