public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
274 stars 53 forks source link

Failed to load error on InsaProfile #71

Closed jagDanJu closed 6 years ago

jagDanJu commented 6 years ago

Hey Guys,

i´am getting the following error with the InsaProfile:

Failed to load https://reiseauskunft.insa.de/bin/mgate.exe?: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

Is there something i can do, to fix this issue?

Greetings Daniel

derhuerst commented 6 years ago

I assume you're trying to use hafas-client in the browser?

While it should work in general, the server needs to allow cross-origin requests via a CORS header. The INSA API doesn't send it, so there's not way to query it from the browser directly.

Please try to convince them to enable CORS, it's an essential part of modern and open APIs.

derhuerst commented 6 years ago

Closing. If you get the error for a different reason, reopen.