Skip to content
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

Adding CORS Proxy for remote files #35

Open
IshaGupta18 opened this issue Jun 8, 2019 · 0 comments
Open

Adding CORS Proxy for remote files #35

IshaGupta18 opened this issue Jun 8, 2019 · 0 comments
Labels
bug Something isn't working gsoc summer of code

Comments

@IshaGupta18
Copy link
Collaborator

When the user adds a link to a remote CSV file, we were getting CORS
Access to XMLHttpRequest at 'file url' from origin 'null' has been blocked by CORS policy: Request header field range is not allowed by Access-Control-Allow-Headers in preflight response.

To resolve this, I have used a CORS proxy

function receive(data){ console.log(data,"data"); } function func(){ var data=[] const proxyurl = "https://cors-anywhere.herokuapp.com/"; const url = "http://insight.dev.schoolwires.com/HelpAssets/C2Assets/C2Files/C2ImportCalEventSample.csv"; fetch(proxyurl + url) .then(response => response.text()) .then(contents => receive(contents)) .catch(() => console.log("Can’t access " + url + " response. Blocked by browser?")) }

This seems to work fine. What do you think, @jywarren ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gsoc summer of code
Projects
None yet
Development

No branches or pull requests

1 participant