This is one of the 'unofficial' endpoints for the Fantasy Premiere League API - https://fantasy.premierleague.com/drf/bootstrap-static.
I am trying to access it in a simple react app from localhost with axios (also tried other fetch methods) but I am getting the following error:
Failed to load https://fantasy.premierleague.com/drf/element-summary/5: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
I tried to use different headers commonly suggested online like Access-Control-Allow-Origin but without success.
Confusingly, online API testers (e.g. https://apitester.com/) and Postman succeed without attaching any headers whatsoever.
My axios code:
return axios({
method: "get",
url: "https://fantasy.premierleague.com/drf/bootstrap-static",
})
I would appreciate any solution or explanation to my problem.