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

Setting CORS When Accessing the Blazegraph Database #227

Open
Superraptor opened this issue May 13, 2022 · 2 comments
Open

Setting CORS When Accessing the Blazegraph Database #227

Superraptor opened this issue May 13, 2022 · 2 comments

Comments

@Superraptor
Copy link

I'm cross-posting an issue I've been having with a local install of the Wikidata Query RDF and the Wikidata Query GUI (https://phabricator.wikimedia.org/T308180), which pertains to the GUI being able to access the Blazegraph hosted at http://localhost:9999. I had attempted to follow a solution mentioned here from 2014, but it unfortunately did not work. I absolutely apologize if this is the wrong location to ask, but I'm at a bit of my wit's end, and I hope I'm missing something obvious which you may be able to help me with.

I am curious if there is a recommended option for setting CORS with Blazegraph. In addition to the solution above, I have tried editing the following into every instance of ./WEB-INF/web.xml in the wikidata-query-rdf directory, which also hasn't worked:

<filter>
   <filter-name>cross-origin</filter-name>
   <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
   <init-param>
       <param-name>allowedOrigins</param-name>
       <param-value>*</param-value>
   </init-param>
   <init-param>
       <param-name>allowedMethods</param-name>
       <param-value>GET,POST,OPTIONS,DELETE,PUT,HEAD</param-value>
   </init-param>
   <init-param>
       <param-name>allowedHeaders</param-name>
       <param-value>origin, content-type, accept, authorization</param-value>
   </init-param>
</filter>
<filter-mapping>
    <filter-name>cross-origin</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Any help would be incredibly appreciated! Thank you for your time!

@alhuber1502
Copy link

Not sure this helps, but I could never get this to work. In the end I used Apache's reverse-proxy mechanism to tunnel any queries. No need for open ports or nginx configuration, and Apache can handle everything CORS-related.

@balhoff
Copy link

balhoff commented May 18, 2022

@Superraptor I use CORS with Blazegraph. You can see the setup in my docker image here: https://github.com/phenoscape/blazegraph-docker/blob/master/Dockerfile

You need to add the jetty-servlets jar to the classpath.

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

No branches or pull requests

3 participants