- Notifications
You must be signed in to change notification settings - Fork5.5k
Add x-xsrftoken to Access-Control-Allow-Headers#2876
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
When starting a kernel using the Jupyter Notebook Kernel API, webbrowsers will automatically check for the presence of `x-xsrftoken` inthe Access-Control-Allow-Headers during the preflight CORS check([ref][ref]).[ref]:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-HeadersSince we didn't allow this header before, web browsers would fail thepreflight check even when the x-xsrftoken header isn't being used by thenotebook server.This meant that running a webpage on localhost:8080 that used Javascriptto start a kernel on a notebook server running on localhost:8888 wouldfail.How I tested this commit:1. Start a notebook server usingjupyter notebook --no-browser --NotebookApp.allow_origin="*" --NotebookApp.disable_check_xsrf=True --NotebookApp.token=''2. Build the [web3](https://github.com/jupyter-widgets/ipywidgets/tree/master/examples/web3) example from ipywidgets.3. In that directory, run `npm run host`.4. Verify that visiting http://localhost:8080/ starts a kernel in the notebook server.
rgbkrk approved these changesSep 30, 2017
Member
rgbkrk commentedSep 30, 2017
This seems like the right choice for the default, thanks. |
Contributor
yuvipanda commentedOct 9, 2017
Do folks think we can make a point release with this? |
Member
rgbkrk commentedOct 9, 2017
Contributor
gnestor commentedOct 9, 2017
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
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.
When starting a kernel using the Jupyter Notebook Kernel API, web
browsers will automatically check for the presence of
x-xsrftokeninthe Access-Control-Allow-Headers during the preflight CORS check
(ref).
Since we didn't allow this header before, web browsers would fail the
preflight check even when the x-xsrftoken header isn't being used by the
notebook server.
This meant that running a webpage on localhost:8080 that used Javascript
to start a kernel on a notebook server running on localhost:8888 would
fail.
How I tested this commit:
Start a notebook server using
Build theweb3 example from ipywidgets.
In that directory, run
npm run host.Verify that visitinghttp://localhost:8080/ starts a kernel in the notebook server.