<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: leaflet-geosearch - localhost blocked by CORS policy in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/leaflet-geosearch-localhost-blocked-by-cors-policy/m-p/790762#M143</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;leaflet-geosearch isn't part of Esri Leaflet. We do maintain our own Esri Leaflet Geocoder library &lt;A class="link-titled" href="https://github.com/Esri/esri-leaflet-geocoder/" title="https://github.com/Esri/esri-leaflet-geocoder/"&gt;GitHub - Esri/esri-leaflet-geocoder: helpers for using the ArcGIS World Geocoding Service in Leaflet&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like leaflet-geosearch is trying to make a request to the HTTP endpoint instead of the HTTPS endpoint. Looking at their code up to their 2.5.1 version this would make an HTTP request since your localhost is HTTPS. &lt;A class="link-titled" href="https://github.com/smeijer/leaflet-geosearch/blob/v2.5.1/src/providers/esriProvider.js#L13" title="https://github.com/smeijer/leaflet-geosearch/blob/v2.5.1/src/providers/esriProvider.js#L13"&gt;leaflet-geosearch/esriProvider.js at v2.5.1 · smeijer/leaflet-geosearch · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like this is resolved at their latest 3.0.5 version though &lt;A class="link-titled" href="https://github.com/smeijer/leaflet-geosearch/blob/v3.0.5/src/providers/esriProvider.ts#L30-L31" title="https://github.com/smeijer/leaflet-geosearch/blob/v3.0.5/src/providers/esriProvider.ts#L30-L31"&gt;leaflet-geosearch/esriProvider.ts at v3.0.5 · smeijer/leaflet-geosearch · GitHub&lt;/A&gt;&amp;nbsp; and the request should always go to HTTPS. Can you try to upgrade to the latest version and see if that works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Nov 2020 23:31:15 GMT</pubDate>
    <dc:creator>PatrickArlt1</dc:creator>
    <dc:date>2020-11-09T23:31:15Z</dc:date>
    <item>
      <title>leaflet-geosearch - localhost blocked by CORS policy</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/leaflet-geosearch-localhost-blocked-by-cors-policy/m-p/790761#M142</link>
      <description>&lt;P style="margin: 0cm;"&gt;&lt;SPAN&gt;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: -&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;EM style="color: #3d3d3d; font-size: 11.5pt; font-family: 'Helvetica',sans-serif;"&gt;import { EsriProvider } from "leaflet-geosearch";&lt;/EM&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;EM style="font-family: 'Helvetica',sans-serif;"&gt;const myProvider = new EsriProvider();&lt;/EM&gt;&lt;BR /&gt;&lt;EM style="font-family: 'Helvetica',sans-serif;"&gt;const results = await myProvider.search({ query: event.target.value });&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN&gt;The error message in the browser console is :-&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;EM style="color: #3d3d3d; font-size: 11.5pt; font-family: 'Helvetica',sans-serif;"&gt;Access to fetch at '&lt;A href="http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=json&amp;amp;text=london" target="_blank"&gt;http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=json&amp;amp;text=london&lt;/A&gt;' from origin '&lt;A href="http://localhost:8080" target="_blank"&gt;http://localhost:8080&lt;/A&gt;' 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.&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0cm; overflow-wrap: break-word; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;"&gt;&lt;SPAN&gt;I would be grateful if someone could advise on how to resolve this error experienced, thanks for support.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 20:20:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/leaflet-geosearch-localhost-blocked-by-cors-policy/m-p/790761#M142</guid>
      <dc:creator>IkeIwumene</dc:creator>
      <dc:date>2023-08-25T20:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: leaflet-geosearch - localhost blocked by CORS policy</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/leaflet-geosearch-localhost-blocked-by-cors-policy/m-p/790762#M143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;leaflet-geosearch isn't part of Esri Leaflet. We do maintain our own Esri Leaflet Geocoder library &lt;A class="link-titled" href="https://github.com/Esri/esri-leaflet-geocoder/" title="https://github.com/Esri/esri-leaflet-geocoder/"&gt;GitHub - Esri/esri-leaflet-geocoder: helpers for using the ArcGIS World Geocoding Service in Leaflet&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like leaflet-geosearch is trying to make a request to the HTTP endpoint instead of the HTTPS endpoint. Looking at their code up to their 2.5.1 version this would make an HTTP request since your localhost is HTTPS. &lt;A class="link-titled" href="https://github.com/smeijer/leaflet-geosearch/blob/v2.5.1/src/providers/esriProvider.js#L13" title="https://github.com/smeijer/leaflet-geosearch/blob/v2.5.1/src/providers/esriProvider.js#L13"&gt;leaflet-geosearch/esriProvider.js at v2.5.1 · smeijer/leaflet-geosearch · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like this is resolved at their latest 3.0.5 version though &lt;A class="link-titled" href="https://github.com/smeijer/leaflet-geosearch/blob/v3.0.5/src/providers/esriProvider.ts#L30-L31" title="https://github.com/smeijer/leaflet-geosearch/blob/v3.0.5/src/providers/esriProvider.ts#L30-L31"&gt;leaflet-geosearch/esriProvider.ts at v3.0.5 · smeijer/leaflet-geosearch · GitHub&lt;/A&gt;&amp;nbsp; and the request should always go to HTTPS. Can you try to upgrade to the latest version and see if that works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Nov 2020 23:31:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/leaflet-geosearch-localhost-blocked-by-cors-policy/m-p/790762#M143</guid>
      <dc:creator>PatrickArlt1</dc:creator>
      <dc:date>2020-11-09T23:31:15Z</dc:date>
    </item>
  </channel>
</rss>

