Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.

Access-Control-Allow-Origin header for /api/ should use Origin domain instead of * #367

Open
bluesmoon opened this issue Mar 8, 2016 · 1 comment

Comments

@bluesmoon
Copy link

When we make an API call using XMLHttpRequest to the JuliaBox API, we need to set withCredentials=true on the XHR object. This adds an Origin: <domain> header, and also passes all Cookies through.

The JuliaBox server (juliabox.org, for example) responds with an Access-Control-Allow-Origin: * header. While this is fine for requests that do not require credentials, it violates CORS for requests that do require credentials. When withCredentials=true is set, we need the actual domain in Access-Control-Allow-Origin.

With ipython, we used to set Access-Control-Allow-Origin: origin in ipython_notebook_config.py. I'm not sure what the equivalent is for jupyter, but I'm sure you do, and can make the required changes for juliabox.

Note that withCredentials=true is required because appropriate auth cookies need to be sent from the browser to juliabox in order to get data for the right user account.

@bluesmoon
Copy link
Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant