Open ReadyPlayerEmma opened 2 years ago
You might want to check out the current code for the APOD API here: https://github.com/nasa/apod-api
Also, it might be helpful to know that the APOD API is run entirely separate from the APOD website, so the person who might respond to issues on APOD API has no ability to do any changes on the APOD site or backend.
APOD API is basically a scrapper of APOD
Following
It appears there's been a broader change in CORS headers across multiple NASA APIs. I was using https://ssd-api.jpl.nasa.gov/doc/fireball.html and it now appears to not support CORS requests, and this is an intentional change from NASA. 😞
This was confirmed with an email exchange from someone at NASA when I reported the issue.
If anyone knows of any CORS friendly similar APIs or mirrors, please add them to this thread!
It appears there's been a broader change in CORS headers across multiple NASA APIs. I was using https://ssd-api.jpl.nasa.gov/doc/fireball.html and it now appears to not support CORS requests, and this is an intentional change from NASA. 😞
That is unfortunate. It seems rather silly to have a public API but not allow cross-origin requests...
Sorry about earlier response. I misunderstood the issue.
I no longer have rights to anything here but just to provide some feedback on this issue.
The problem you're seeing isn't anything to do with api.nasa.gov , it is with apod.nasa.gov. That's the URL you're calling when you have the CORS issue.
API.nasa.gov & APOD.nasa.gov are run by entirely separate groups. Discussing the problem here doesn't get it any views from the folks who run APOD I'm afraid. You might look into the contact details on the APOD page: https://apod.nasa.gov/apod/lib/about_apod.html They may be able to help if they have access to that level of the server, which they may or may not.
As I short term work around, you might look into a CORS proxy as described here: https://stackoverflow.com/questions/43262121/trying-to-use-fetch-and-pass-in-mode-no-cors
Also, in case anyone else stumbles upon this issue, you'll only see this issue for things calling for images via APOD.nasa.gov link and front-end JavaScript. It won't appear if this call to apod.nasa.gov is done via a backend method [curl, python, node.js, etc.]
It should really be fixed on the APOD.nasa.gov side as so many things have been built on those APOD.nasa.gov image URLs, but might flag @MilesCrabbe in case there are less ideal fixes possible on the api.nasa.gov side of things.
In my case I couldn't export Canvas because of CORS, I solved it by converting the image to base64 on the server.
Previously, based on older issues, there was a suffix path
/direct
that could appended to the APOD API which would return the image itself, but with CORS allow-origin headers present. It seems to be the below issue referenced by @amygoodchild in a comment back in January.I have searched but am unable to find an alternative endpoint in any documentation which provides that ability. Was this feature removed? Could it be enabled again? Or perhaps the APOD webserver where the images are hosted could be updated to add CORS headers when serving image file types from within the paths used for serving APOD images?
Mozilla provides details on the process here: https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
The original referenced post:
Originally posted by @amygoodchild in https://github.com/nasa/api-docs/issues/37#issuecomment-759621330