Hello,
I am developing a web application that uses the MTA Bus Time API to fetch real-time vehicle data. While the API works perfectly in a Dart script (dart run), I am encountering a CORS issue when running the app in the browser.
Here are the details of the error:API Endpoint:
https://bustime.mta.info/api/siri/vehicle-monitoring.jsonError Message:
HTTP Status Code: 302 (Found)
It seems the Access-Control-Allow-Origin header in the API response is set to
https://bustime-beta.mta.info, which does not match my app's origin (
http://localhost:16132). This is causing the browser to block the request.
Questions:Is there a way to configure the API to allow requests from my app's origin during development?
Are there any recommended workarounds for handling this issue in a web app?
Thank you for your assistance!