aws / graph-explorer

React-based web application that enables users to visualize both property graph and RDF data and explore connections between data without having to write graph queries.
https://github.com/aws/graph-explorer
Apache License 2.0
317 stars 47 forks source link

[Bug] SPARQL access to queryid header leads failed search #393

Closed JervenBolleman closed 4 months ago

JervenBolleman commented 4 months ago

Description

Attempting to run graph-explorer on a sparql endpoint specifically https://beta.sparql.swisslipids.org fails in firefox due to an

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://beta.sparql.swisslipids.org/sparql. (Reason: header ‘queryid’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response)

queryid is not a standard header and the code should expect that no access is possible.

Environment

Steps to Reproduce

Add a database https://beta.sparql.swisslipds.org sync, and then open the explorer for the dataset /explorer/#/graph-explorer search for "15-methylhexadecasphinganine" see failure message red box and CORS failures in the firefox console.

Expected Behavior

A successful search


[!IMPORTANT] If you are interested in working on this issue or have submitted a pull request, please leave a comment. The queryid is an interesting header to add, so I will add this to our endpoints and reproducing this in the future might be hard.

I am trying to have a look at the code to see if I can suggest a patch.

JervenBolleman commented 4 months ago

I am trying to have a look at the code to see if I can suggest a patch.

kmcginnes commented 4 months ago

Possibly related

kmcginnes commented 4 months ago

@JervenBolleman Can you try using Graph Explorer with the proxy server?

You can refer to the notes in this comment for some basic instructions:

https://github.com/aws/graph-explorer/issues/364#issuecomment-2107936217

kmcginnes commented 4 months ago

ok, I was able to get https://beta.sparql.swisslipids.org/ working locally with the proxy server. It did require some code changes around how the proxy server is constructing the request. The big one was adding the Accept: 'application/json' to the header.

kmcginnes commented 4 months ago

@JervenBolleman Can you try my branch and configuration settings to see if it works for you?

kmcginnes commented 4 months ago

I'm sorry, I closed this prematurely.

JervenBolleman commented 4 months ago

@kmcginnes thank you. This works nicely with the proxy. I am still going to make this work without the proxy out of the box by adding the expected required headers to our endpoints. graph-1715931789225