propublica / sunlight-congress

The Sunlight Foundation's Congress API. Shut down on Oct. 1, 2017.
https://www.propublica.org/nerds/item/congress-api-bill-subjects-personal-explanations-and-sunsetting-sunlight
Other
169 stars 65 forks source link

CORS Issue #534

Closed llamasoft-dotcom-demo closed 7 years ago

llamasoft-dotcom-demo commented 7 years ago

Attempting to call the health check endpoint from my browser client (localhost, development environment), and getting a CORS problem:

XMLHttpRequest cannot load https://congress.api.sunlightfoundation.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.

Code looks like:

$.get(https://congress.api.sunlightfoundation.com)

Using Chrome 54.0.2840.87.

I don't yet have an API key, as the page looks like it's down. This endpoint shouldn't require it, though. The doc also mentions all domains are allowed, so it should "Just Work". Is this something that's being addressed, or is it an issue on my end?

Thanks!

konklone commented 7 years ago

I think the whole thing is down for now:

$ curl --head https://congress.api.sunlightfoundation.com
HTTP/2 504 
content-type: text/html
content-length: 183
server: nginx/1.1.19
date: Sun, 13 Nov 2016 04:35:44 GMT
x-cache: Error from cloudfront
via: 1.1 de390f2a4c2c110d009e8b1fc0fb9346.cloudfront.net (CloudFront)
x-amz-cf-id: L56Etr9RqxSPnFtiV1mle6vtSx36xO9CBgnVHYYTOW0XlbOIXSk75g==
TheTFo commented 7 years ago

I can access the URL directly through the browser. My issue occurs during an AJAX request.

TheTFo commented 7 years ago

https://github.com/propublica/congress/commit/99679be91086ce14bc73d4887c4787101314b05c

Looks like it's due to this commit.

llamasoft-dotcom-demo commented 7 years ago

Sorry, I posted this under my other account. Meant to use this one.

Please see this issue:

https://github.com/propublica/congress/issues/535