You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@marmotta.apache.org by Rune Stilling <su...@rdfined.dk> on 2018/05/27 06:43:36 UTC

No 'Access-Control-Allow-Origin' header is present

Hi list

I’m trying to get a simple javascript calling the ldp webservice in Marmotta up and running. I’m making use of CORS but it doesn’t seem to work.

This is my javascript:

> function getCORS(url, success) {
>     var xhr = new XMLHttpRequest();
>     xhr.open('GET', url);
>     xhr.setRequestHeader("Authorization", "Basic " + btoa("admin:pass123"));
>     xhr.withCredentials = "true";
>     xhr.onload = success;
>     xhr.send();
>     return xhr;
> }
> 
> // example request
> getCORS('http://foo:8080/marmotta/ldp/FORM-7', function(request){
>     var response = request.currentTarget.response || request.target.responseText;
>     console.log(response);
> });


I get the following error though:

> Failed to load http://83.169.40.208:8080/marmotta/ldp/FORM-7: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://83.169.40.208' is therefore not allowed access.

It seems it should be supported so what am I doing wrong?

Regards,
Rune Stilling