AnsweredAssumed Answered

leaflet-geosearch - localhost blocked by CORS policy

Question asked by ma06rii on Oct 16, 2020

Hello, I would like to ask if anyone else is experiencing a CORS error when working with "EsriProvider" from "leaflet-geosearch" library. This error has been noticed very recently. It occurs when hosting a web application in a development environment on "localhost". The code which triggers the error is as follows: -


import { EsriProvider } from "leaflet-geosearch";
const myProvider = new EsriProvider();
const results = await{ query: });


The error message in the browser console is :-


Access to fetch at '' from origin 'http://localhost:8080' 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.


I would be grateful if someone could advise on how to resolve this error experienced, thanks for support.