USDA / USDA-APIs

Do you have feedback, ideas, or questions for USDA APIs? Use this repository's Issue Tracker to join the discussion.
www.usda.gov/developer
109 stars 16 forks source link

CORS header missing #66

Open westwood846 opened 5 years ago

westwood846 commented 5 years ago

So my Angular app started throwing CORS errors today and sure enough, checking with curl there's no Access-Control-Allow-Origin: * header present on the response. I'm sure it has been there before because #36 mentions adding the header and my app used to be able to talk to the API before.

curl -X GET -G https://api.nal.usda.gov/ndb/search -d "api_key=ABDC1234" -d "q=broccoli" -v:

< HTTP/1.1 200 
< Server: openresty
< Date: Thu, 06 Jun 2019 05:15:17 GMT
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< X-RateLimit-Limit: 3600
< X-RateLimit-Remaining: 3544
< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
< Age: 0
< Via: https/1.1 api-umbrella (ApacheTrafficServer [cMsSf ])
< X-Cache: MISS
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Can we get this re-enabled?

littlebunch commented 5 years ago

This should be fixed now.

Also, just a reminder to all NDB API users that the Food Data Central API (https://fdc.nal.usda.gov/api-guide.html) is slated to replace the NDB API by the end of the this year. It is important that you evaluate FDC in terms of your functional requirements and let us know what changes you might want/need in the new API. You can provide your questions, comments and concerns using the “Queries and Comments” form listed at https://fdc.nal.usda.gov/contact.html. If you post the same to this list, I will make sure that FDC staff receives a copy. -Gary

On Jun 6, 2019, at 3:01 AM, Marco Brack notifications@github.com wrote:

curl -X GET -G https://api.nal.usda.gov/ndb/search https://api.nal.usda.gov/ndb/search -d "api_key=ABDC1234" -d "q=broccoli" -v

westwood846 commented 5 years ago

Can confirm, the header is present and my app is working again. Thanks for the quick response!

The new FDC API has the header already enabled, should I still post this to the list? Also, will this issue tracker apply to the new API as well or is it only that contact form for now?

Maybe we could add the above notice to the readme so it does not get buried when this issue gets closed.