smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.03k stars 273 forks source link

error cors #171

Closed behnammodi closed 6 years ago

behnammodi commented 6 years ago

i have get error cors when use leaflet-geosearch

screen shot 2018-07-16 at 6 06 28 pm
ignacy130 commented 6 years ago

Try explicit request like: var results = await this.$http.get('https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(this.query + ", Warsaw, Poland"));

But I agree that it's not how it should work ; )

behnammodi commented 6 years ago

@ignacy130 What's the difference?

rousos87 commented 6 years ago

@ignacy130 The problem is because you are using http instead of https. Unfortunately there is a pull request here (https://github.com/smeijer/leaflet-geosearch/pull/164) but is not merged yet. Nominatim project announced that from now on you have to use https. One easy way to do it,is to change the file inside dist folder.

Replace this:

return ${protocol}//nominatim.openstreetmap.org/search?${paramString};

with this

return https://nominatim.openstreetmap.org/search?${paramString};

Hope it helps

smeijer commented 6 years ago

Closed by 04cab81. Thanks for the support @ignacy130 and @rousos87. Sorry it took so long.