covid-tracking-api icon indicating copy to clipboard operation
covid-tracking-api copied to clipboard

US Endpoint blocked by CORS policy

Open richcorbs opened this issue 4 years ago • 3 comments

Access to fetch at 'https://covidtracking.com/api/us' from origin 'https://www.richcorbs.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

richcorbs avatar Apr 06 '20 17:04 richcorbs

@richcorbs i found that adding .json to the end of the url fixed this. Some redirect rule gone awry I suspect.

joshwand avatar Apr 06 '20 17:04 joshwand

Looks like the redirect doesn't provide the Access-Control-Allow-Origin. I've disabled the redirect.

webmasterkai avatar Apr 06 '20 17:04 webmasterkai

Last week the states/daily end point stopped working with .json and the solution was to remove it. The us end point continued to work with .json but I removed it for consistency sake and it continued to work.

Today I learn that us.json is right and states/daily.json works again too.

Hard to work with a moving target. What is the right/official way to use the API? I see in the documentation today that .json seems to be preferred. Is that correct?

richcorbs avatar Apr 06 '20 18:04 richcorbs