I have set up a local Solr Server running on port 8983 on windows. Now I'm trying to use HTTP GET request from AJAX to fetch data from the Solr but facing below error:
XMLHttpRequest cannot load http://localhost:8983/solr/TestCore5/select. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Here is my code snippet:
$http({
method: 'GET',
headers: {
"Content-Type": "application/json",
},
url: 'http://localhost:8983/solr/TestCore5/select',
data: {
"q": $scope.name,
"fl": "resourcename",
"wt": "json",
}
})
Please suggest how to fix this. Any configurations(solr-config.xml
or solr.xml
) can be updated? How?
The below link helped me to fix the issue:
Specify the Cross-Origin filters in the web.xml file of your solr package.