I am creating an angular application, and I want to use the preconfigured ‘files’ service to store some .pdf files.
I created a folder ‘pdfs’ and a .pdf file ‘testpdf1.pdf’, and placed them into the ‘files’ folder like so: files/pdfs/testpdf1.pdf.
Then I tried to GET testPdf1.pdf in angular like so
$http({
method: 'GET',
url: 'http://someUrl.com/api/v2/files/pdfs/testpdf1.pdf?download=false',
headers: {
'X-DreamFactory-Api-Key': 'theApiKey',
'X-DreamFactory-Session-Token': 'theToken'
}
}).then(function(response){
console.log('Success');
console.log(response);
}, function(err){
console.log('Failure');
console.log(err);
});
For some reason this causes a CORS error. Which is peculiar because
- I have configured the CORS settings to accept everything
- I have already successfully communicated to this API without getting a CORS error
- I can perform the same API call in API Docs and Postman
- I can do a GET files/pdfs/ without problem
What could be the problem, and what could be done to fix it?