racemap/elevation-service

CORS problem

Closed this issue · 4 comments

When I try to do a GET request with javascript, I get this error message on my browser console (I assume POST will complain on the same way):

Access to fetch at 'https://elevation.racemap.com/api?lat=12.3&lng=45.6' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

It is strange for an API to have CORS enabled. Is there any way to workaround it?
Thanks.

I just deployed a version with CORS headers. Let me know if that works for you.

Yes, it works! Thank you for the quick fix.

It happens again
Access to fetch at 'https://elevation.racemap.com/api' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Changes in the server?
Thanks

We had some overload on the server. Should be working better now.