This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
Inconsistent behavior between WebSocketChannelsHandler and others #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix the inconsistent behavior between WebSocketChannelsHandler and the other Handlers when using NotebookApp.allow_origin configuration. The WebSocketChannelsHandler uses the
check_origin
method from WebSocketHandler by default.The problem is discovered by following steps:
I'm using nb2kg with Jupyter Notebook to launch kernels on spark. The notebook server runs behind an nginx proxy.
The NotebookApp.allow_origin was set as:
c.NotebookApp.allow_origin = '*'
However, the server returned 403 when the frontend connected to the successfully created kernel.
The server showed the following logs:
[D 12:54:07.104 NotebookApp] Initializing websocket connection /api/kernels/50852902-0ffe-4973-b550-a2424bf4f86d/channels [W 12:54:07.108 NotebookApp] 403 GET /api/kernels/50852902-0ffe-4973-b550-a2424bf4f86d/channels?session_id=E5BB1B111B8D4B4DAF798597772E5578 (10.244.0.91) 4.93ms referer=None [D 12:54:07.109 NotebookApp] Cross origin websockets not allowed