thundermiracle / geocoder-free

get latitude and longitude by address without using google map api
MIT License
11 stars 1 forks source link

Blocked By CORS #92

Open idhaun opened 1 year ago

idhaun commented 1 year ago

Hello,

I got Problem with cross Origin:

Access to fetch at 'https://www.google.com/search?gl=jp&tbm=map&q=Friedrich-Kauth-Weg%201%2C%20DEUTSCHLAND%2078588%20Denkingen' from origin 'http://ns400gt:8010' 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.

Is there a possibility to remove header?

thundermiracle commented 1 year ago

Hi idhaun,

CORS policy is set by Google's server and cannot be modified. So I used JsonP (wiki) to avoid the CORS problem, but that doesn't always work well.

The best solution is using this library on server side to avoid CORS. I think serverless function is not a bad choice.