Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

is CORS working for anybody ? #204

Closed
deresegetachew opened this issue Aug 14, 2019 · 7 comments
Closed

is CORS working for anybody ? #204

deresegetachew opened this issue Aug 14, 2019 · 7 comments
Labels
#answered #question Further information is requested

Comments

@deresegetachew
Copy link

deresegetachew commented Aug 14, 2019

I have been trying to run superset-storybook for 2 days now and I keep on getting CORS error.
Yes I have followed the guides ; installed superset[cors] and set enable_cors to true;

other than that I have also followed this guide
#118 (comment)

looking at the response from the server i noticed we are not getting the response header
Access-Control-Allow-Origin

this is what my superset_config.py looks like

ENABLE_CORS = True
CORS_OPTIONS = {
    'supports_credentials': True,
    'allow_headers': [
        'X-CSRFToken', 'Content-Type', 'Origin', 'X-Requested-With', 'Accept',
    ],
    'resources': [
         '/superset/csrf_token/'  # auth
         '/api/v1/formData/',  # sliceId => formData
         '/superset/explore_json/*',  # legacy query API, formData => queryData
         '/api/v1/query/',  # new query API, queryContext => queryData
         '/superset/fetch_datasource_metadata/'  # datasource metadata

    ],
    'origins': ['http://localhost:9001','http://localhost:3000'],
}

And the following are the error in chrome and HTTP request and response headers.

Screenshot from 2019-08-14 15-31-31
Screenshot from 2019-08-14 17-02-42 (1)

FYI the superset-storybook live demo does n't work as well.
https://apache-superset.github.io/superset-ui/

has any one faced the same issue ?
thank you

@issue-label-bot issue-label-bot bot added the #question Further information is requested label Aug 14, 2019
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label #question to this issue, with a confidence of 0.89. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@williaster
Copy link
Contributor

@deresegetachew which browser are you using? chrome v76 broke this for us and were were able to fix it by setting chrome://flags/#out-of-blink-cors to disabled (v75 was disabled by default, v76 is enabled by default)

@williaster
Copy link
Contributor

FYI the superset-storybook live demo does n't work as well.

This is because there is no public superset instance for it to talk to.

@deresegetachew
Copy link
Author

deresegetachew commented Aug 15, 2019

hi @williaster thank you for the response. I have tried both FireFox and Chrome ; I did set out-of-link-cors to disabled as you mentioned but I am still getting the CORS errors in chrome as well as firefox.

In chrome it fails to load the response data, while in fire-fox I get the token but still get a CORS Warning and also some error as shown below. I have attached a screen shot of the errors in chrome and firefox below.

--Error in Chrome--
Screenshot from 2019-08-15 10-10-17

--Error in FireFox--
Screenshot from 2019-08-15 10-12-35

---CORS Warning in FireFox and Error in Chrome--

Screenshot from 2019-08-15 10-13-05
Screenshot from 2019-08-15 10-11-57

Is there any reason why the flask app is not sending Acccess-Control-Allow-Origin Header ?

Thank you in advance.

@deresegetachew
Copy link
Author

hi @williaster any ideas how to solve this issues now i am working on moving to production ?

@deresegetachew
Copy link
Author

Hello; The original code superset_config.py was missing a comma :( now it works.
I have added a comma after '/superset/csrf_token/'.
I actually copied the code from @superset-connection

ENABLE_CORS = True
CORS_OPTIONS = {
    'supports_credentials': True,
    'allow_headers': [
        'X-CSRFToken', 'Content-Type', 'Origin', 'X-Requested-With', 'Accept',
    ],
    'resources': [
         '/superset/csrf_token/' , # auth
         '/api/v1/formData/',  # sliceId => formData
         '/superset/explore_json/*',  # legacy query API, formData => queryData
         '/api/v1/query/',  # new query API, queryContext => queryData
         '/superset/fetch_datasource_metadata/'  # datasource metadata

    ],
    'origins': ['http://localhost:9001','http://localhost:3000'],
}

kristw pushed a commit that referenced this issue Apr 17, 2020
* fix: Line not hidden after legend selection

* fix: lint issues
@villebro
Copy link
Contributor

The codebase on this repo has been moved to the main Apache Superset repo, and consequently the repo is in the process of being archived. See the Superset Improvement Proposal for details: apache/superset#13013 . While all currently open issues and PRs will be closed, we encourage you to reopen this issue on the main repo if it is still relevant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
#answered #question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants