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

No 'Access-Control-Allow-Origin' header causes error in Linked Data Browser #83

Closed
bhaugen opened this issue Nov 6, 2015 · 4 comments
Closed
Labels

Comments

@bhaugen
Copy link
Contributor

bhaugen commented Nov 6, 2015

We tried NRP jsonld error in @ahdinosaur 's Linked Data Browser

http://dinosaur.is/linked-data-browser/?focusId=http%3A%2F%2Fnrp.webfactional.com%2Faccounting%2Fagent-jsonld%2F

focus @id:
http://nrp.webfactional.com/accounting/agent-jsonld/

we get this error:

Fetch API cannot load http://nrp.webfactional.com/accounting/agent-jsonld/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dinosaur.is' is therefore not allowed access.

We'll add the required header. This issue is just to record the requirement. This is not a bug in the Linked Data Browser, just in the NRP jsonld feed. (Or so I think...)

@bhaugen bhaugen added the bug label Nov 6, 2015
@bhaugen
Copy link
Contributor Author

bhaugen commented Nov 6, 2015

@ahdinosaur - how do you get away with this re https://rawgit.com/valueflows/agent/master/examples/enspiral.jsonld ? I don't see any header there, either.

P.S. looks like this might be what we need to do:
https://github.com/ottoyiu/django-cors-headers

@ahdinosaur @fosterlynn does this make sense to you, or is there a simpler method? I plead ignorance on this topic, but it looks like something we need to do post-haste for what we want to do here...

Or @ahdinosaur - is it possible that your code is too strict? This is just a GET, right?

@ahdinosaur
Copy link
Member

yeah nah, this is expected. CORS headers are necessary for a browser to communicate with a server at a different domain then where the page was loaded.

with curl -iL "https://rawgit.com/valueflows/agent/master/examples/enspiral.jsonld", i see Access-Control-Allow-Origin: * in the headers. rawgit.com seems to add the proper CORS headers, as opposed to raw.githubusercontent.

here's a resource on how to enable CORS on servers. for example, here's how i added CORS support to our valueflo.ws http server.

@bhaugen
Copy link
Contributor Author

bhaugen commented Nov 6, 2015

@ahdinosaur - you're right, I was thinking stupidly about it. I think that django app will do it for us, but we'll see.

@bhaugen
Copy link
Contributor Author

bhaugen commented Nov 9, 2015

Yay! It works now!
http://dinosaur.is/linked-data-browser/?viewId=nodeList&focusId=http%3A%2F%2Fnrp.webfactional.com%2Fapi%2Fagent-jsonld%2F

@ahdinosaur and all: note that the URL has changed. I moved all the jsonld stuff under /api/ instead of /accounting/

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

No branches or pull requests

2 participants