Open MinimumViablePerson opened 6 years ago
Hello @MinimumViablePerson! Thank you for the kind words, it's always fun to hear from people that are using it. It sounds really weird that you're having CORS issues since that's enabled here. What's even more interesting is that you only get it for House Stark. Could you please elaborate with some more information regarding your request payload and the response you're getting?
It would also be nice to see what code you're using to make the request itself.
Hi @joakimskoog. I'm also having a similar issue, but with House Targaryn, as well as Tully, Aaryn, Baelish, and some others. Using this jquery call: $.get("https://anapioficeandfire.com/api/houses/378",displaydata) I get this error: Access to XMLHttpRequest at 'https://anapioficeandfire.com/api/houses/378' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
It works as expected with House Stark for me, not sure if that was an issue that got fixed because of this thread or just a coincidence. Thanks!
Hi,
Could you please provide the code for the request including how the HTTP request actually looks like. Would also be helpful to know from what URL you were calling the API.
Does it always happen for specific houses or is it something that comes and goes?
I'm also having CORS issues. If I'm calling get(https://anapioficeandfire.com/api/characters?name=Jon Snow) I get CORS error:
"Access to XMLHttpRequest at 'https://anapioficeandfire.com/api/characters?name=Jon%20Snow' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."
While calling eg. get(https://anapioficeandfire.com/api/characters?name=Jaime Lannister) there's NO error.
I've just tested the @baranna 's Jon Snow endpoint and I also get a CORS error on that one but not on others, like Arya Stark. This is bastardism! 😋
It may help somebody.
I get the same problem when trying to fetch(https://anapioficeandfire.com/api/books)
but when adding / after books it solves the CORS policy problem.
Hey @joakimskoog, thanks for this great open API, it's been really helpful for my students to practice their fetching skills.
Although it's worked well in the past, we are all currently getting CORS errors when trying to fetch from any domain other than https://anapioficeandfire.com, which unfortunately renders the API unusable for with JS.
Update: The CORS issue appears to be only for house Stark (362), I've tested other houses and they worked.