Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS error when retreiving bill text from URL #292

Open
lostplusfound opened this issue Nov 21, 2024 · 2 comments
Open

CORS error when retreiving bill text from URL #292

lostplusfound opened this issue Nov 21, 2024 · 2 comments

Comments

@lostplusfound
Copy link

Hello,

I’m encountering a CORS error when attempting to access the text of a bill from a flutter application running as a web app on Chrome. Specifically, accessing the api.congress.gov/bill/{congress}/{billType}/{billNumber}/text endpoint works, however when I try to access the URL in the formats property of the response such as https://www.congress.gov/117/bills/hr3076/BILLS-117hr3076enr.pdf to retrieve the text of the bill it is blocked by CORS policy.

Here's how to reproduce the issue in dart using my example URL:
http.get(Uri.parse('https://congress.gov/118/bills/hr815/BILLS-118hr815enr.htm'));

Here’s the error message from the browser console:
Access to XMLHttpRequest at 'https://congress.gov/118/bills/hr815/BILLS-118hr815enr.htm' from origin 'http://localhost:38581' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I've noticed that this error happens only when trying to access URLs that start with congress.gov instead of api.congress.gov, such as when getting the PDF for a daily congressional record, for instance https://www.congress.gov/118/crec/2024/11/20/170/172/CREC-2024-11-20.pdf

This issue limits the use of the Congress API for web applications. It would be great if this could be resolved so web platforms can have more functionality with the API.

Thank you!

@wblackerby
Copy link
Collaborator

Hi @BreathFirstSearch thanks for reporting this. We will take a closer look.

@wblackerby
Copy link
Collaborator

Previous (but different) CORS issues: #33 and #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants