Hi Robert,
Which version are you running?
For me,
> /fuseki-server --cors cors-config.ttl
works for 6.1.0, whereas 5.2.0 says:
"No dataset specified on the command line."
Andy
On 04/06/2026 13:16, Chavez, Robert wrote:
Greetings,
I am wondering if anyone could point me to some CORS configuration examples to
configure CORS for a standalone Fuseki server run at the command line.
I’ve searched high and low for some workable examples, but so far have not
found anything that works successfully, official documentation doesn’t have
much on the subject either.
What I’ve managed to glean from available information so far is that I can
declare a CORS configuration file with appropriate allow rules, something like:
@prefix fuseki: <http://jena.apache.org/fuseki#> .
<#corsConfig> a fuseki:CORSConfiguration ;
fuseki:allowedOrigin "https://example.cloudfront.net" ;
fuseki:allowedMethod "GET" ;
fuseki:allowedMethod "POST" ;
fuseki:allowedHeader "Content-Type" ;
fuseki:allowedHeader "Origin" ;
fuseki:allowedHeader "X-Requested-With" ;
fuseki:allowedHeader "Accept" ;
fuseki:maxAge 3600 .
And then call that config file from the command line when launching Fuseki with:
/fuseki-server --cors cors-config.ttl
With this approach I was assuming that the CORS configuration would apply to
any endpoint declared in the main config (see below) with fuseki:serviceQuery.
But, that does not seem to be the case.
This results in a “No services found error"
As a result, I am wondering if the CORS config needs to be integrated somehow
with the main config file.
If this is the base configuration:
PREFIX : <http://base/#>
PREFIX fuseki: <http://jena.apache.org/fuseki#>
PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
PREFIX schema: <https://schema.org/>
PREFIX text: <http://jena.apache.org/text#>
:service_tdb_all rdf:type fuseki:Service;
rdfs:label "TDB2 chd";
fuseki:dataset :text_dataset;
fuseki:name "chd";
fuseki:serviceQuery "query" , "sparql" , "";
fuseki:serviceReadGraphStore "get";
fuseki:serviceReadWriteGraphStore
"data";
fuseki:serviceUpdate "" , "update";
fuseki:serviceUpload "upload” .
I’m unsure of how to incorporate the CORS configuration intros config, this is
where some examples would be helpful.
Perhaps something like this for the “sparql” endpoint?
PREFIX : <http://base/#>
PREFIX fuseki: <http://jena.apache.org/fuseki#>
PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
PREFIX schema: <https://schema.org/>
PREFIX text: <http://jena.apache.org/text#>
:service_tdb_all rdf:type fuseki:Service;
rdfs:label "TDB2 chd";
fuseki:dataset :text_dataset;
fuseki:name "chd”;
fuseki:serviceQuery "query" , "sparql" , "”;
## SPARQL query services e.g. http://host:port/chd/sparql?query=
fuseki:endpoint [
fuseki:operation fuseki:query ;
fuseki:name "sparql";
fuseki:CORSConfiguration [
fuseki:allowOrigin "https://example.cloudfront.net" ;
fuseki:allowMethods "GET, POST," ;
fuseki:allowHeaders "Content-Type,
Authorization” ;
fuseki:allowedHeader "Origin" ;
fuseki:allowedHeader "X-Requested-With" ;
fuseki:allowedHeader "Accept" ;
fuseki:maxAge 3600 .
]
] ;
fuseki:serviceReadGraphStore "get";
fuseki:serviceReadWriteGraphStore
"data";
fuseki:serviceUpdate "" , "update";
fuseki:serviceUpload "upload” .
The above is just a guess, so any guidance would be greatly appreciated.
Thank you,
Robert