<?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: No 'Access-Control-Allow-Origin' header is present on the requested resource. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1365288#M83236</link>
    <description>&lt;P&gt;`&lt;SPAN&gt;Access-Control-Allow-Origin` is a header configured by the server, not by a client.&amp;nbsp;&amp;nbsp;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin" target="_blank"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2024 11:19:36 GMT</pubDate>
    <dc:creator>ViktorSafar</dc:creator>
    <dc:date>2024-01-02T11:19:36Z</dc:date>
    <item>
      <title>No 'Access-Control-Allow-Origin' header is present on the requested resource.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1363858#M83193</link>
      <description>&lt;P&gt;I meet a problem when using ARCGIS JavaScript(version 4.9) to handle map data. My environment is node.js with express.&lt;BR /&gt;the following is my code snippet:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;esriConfig&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;request&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;trustedServers&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;push&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://XXXX.XXX.XX.118:3070" target="_blank" rel="noopener"&gt;https://XXXX.XXX.XX.118:3070&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;BR /&gt;......&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;newBasemap = new TileLayer({&lt;BR /&gt;url: "&lt;A href="https://arcgis.tpgos.gov.taipei/arcgis/rest/services/ED/GD_Plain_Service/MapServer" target="_blank" rel="noopener"&gt;https://arcgis.tpgos.gov.taipei/arcgis/rest/services/ED/GD_Plain_Service/MapServer&lt;/A&gt;",&lt;BR /&gt;crossOrigin: 'anonymous',&lt;BR /&gt;spatialReference: { wkid: 102443 }&lt;BR /&gt;});&lt;BR /&gt;if (newBasemap != undefined) {&lt;BR /&gt;map.add(newBasemap);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;and this cause an error message .&lt;BR /&gt;The Error message show [Access to image ...from origin ... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I found the image element not insert into map object, it is reject when fetching then throw the error. So I use following codes to catch event before image loading data, but it is still invalid.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;BR /&gt;var observerConfig = { childList: true, subtree: true };&lt;BR /&gt;&lt;BR /&gt;// Callback function to handle mutations&lt;BR /&gt;function handleMutations(mutations) {&lt;BR /&gt;mutations.forEach(function (mutation) {&lt;BR /&gt;console.log("call event");&lt;BR /&gt;if (mutation.addedNodes.length &amp;gt; 0) {&lt;BR /&gt;// Handle added nodes (images)&lt;BR /&gt;$(mutation.addedNodes).filter('img').attr("crossorigin", "true");&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Create a new MutationObserver with the callback function&lt;BR /&gt;var observer = new MutationObserver(handleMutations);&lt;BR /&gt;&lt;BR /&gt;// Start observing the target node (divmap) and the specified configuration&lt;BR /&gt;observer.observe(document.getElementById('divmap'), observerConfig);&lt;/P&gt;&lt;P&gt;Does any one know how to solve this problem, any instruction is highly appreciated, thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Dec 2023 03:43:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1363858#M83193</guid>
      <dc:creator>AbramhumHsu</dc:creator>
      <dc:date>2023-12-25T03:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: No 'Access-Control-Allow-Origin' header is present on the requested resource.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1363926#M83195</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/749576"&gt;@AbramhumHsu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cross-Origin Resource Sharing&lt;/STRONG&gt;&amp;nbsp;(&lt;A href="https://developer.mozilla.org/en-US/docs/Glossary/CORS" target="_blank"&gt;CORS&lt;/A&gt;) is an&amp;nbsp;&lt;A href="https://developer.mozilla.org/en-US/docs/Glossary/HTTP" target="_blank"&gt;HTTP&lt;/A&gt;-header based mechanism that allows a server to indicate any&amp;nbsp;&lt;A href="https://developer.mozilla.org/en-US/docs/Glossary/Origin" target="_blank"&gt;origins&lt;/A&gt;&amp;nbsp;(domain, scheme, or port) other than its own from which a browser should permit loading resources.&lt;/P&gt;&lt;P&gt;You need to add the appropriate response header `Access-Control-Allow-Origin' and specify the origin you application is running on, to the web server hosting the service. If your using IIS you can follow these instructions:&lt;A href="https://learn.microsoft.com/en-us/iis/extensions/cors-module/cors-module-configuration-reference" target="_blank"&gt;https://learn.microsoft.com/en-us/iis/extensions/cors-module/cors-module-configuration-reference&lt;/A&gt;&amp;nbsp;if not just google enable CORS on Apache or whatever web server is being used.&lt;/P&gt;&lt;P&gt;If you are using ArcGIS Enterprise there are some settings in there as well that may need modification,&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/server/latest/administer/windows/restricting-cross-domain-requests-to-arcgis-server.htm" target="_blank"&gt;https://enterprise.arcgis.com/en/server/latest/administer/windows/restricting-cross-domain-requests-to-arcgis-server.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 14:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1363926#M83195</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-12-22T14:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: No 'Access-Control-Allow-Origin' header is present on the requested resource.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1364125#M83197</link>
      <description>&lt;P&gt;Adding on to Sage's comments, this looks like an issue with Express and not related to the ArcGIS JS SDK. Here's a link to their documentation: &lt;A href="https://expressjs.com/en/resources/middleware/cors.html" target="_blank"&gt;https://expressjs.com/en/resources/middleware/cors.html&lt;/A&gt;. They specify a number of different CORS options that might fix the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 22:59:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1364125#M83197</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2023-12-22T22:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: No 'Access-Control-Allow-Origin' header is present on the requested resource.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1364225#M83202</link>
      <description>&lt;P&gt;My environment is node.js with express. I have tried cors, but it is invalid. I have re-post the problem with more detailed description.&lt;/P&gt;&lt;P&gt;The main problem is in tileLayer, in some cases, each query of map image should add header"Access-Control-Allow-Origin", like the leaflet.js do, since these server not auto support this, and that cause the cors error. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Dec 2023 05:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1364225#M83202</guid>
      <dc:creator>AbramhumHsu</dc:creator>
      <dc:date>2023-12-25T05:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: No 'Access-Control-Allow-Origin' header is present on the requested resource.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1364239#M83203</link>
      <description>&lt;P&gt;I have use&amp;nbsp; esriConfig.request.trustedServers.push, and it add&amp;nbsp;'Access-Control-Allow-Origin' header when sending json request to the map server, but when query image to map server after that, it cause cors error, and I found the&amp;nbsp;'Access-Control-Allow-Origin' header of each image query is empty, even I have add option&amp;nbsp;&lt;SPAN&gt;crossOrigin&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;'anonymous'.&amp;nbsp;&lt;BR /&gt;And each image ARCGIS query will be combined into a big picture by ARCGIS JAVASCRIPT itself, I found this behavior is not the same as leaflet.js. And that cause the cors error. Do you know anything about this problem, thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Dec 2023 05:24:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1364239#M83203</guid>
      <dc:creator>AbramhumHsu</dc:creator>
      <dc:date>2023-12-25T05:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: No 'Access-Control-Allow-Origin' header is present on the requested resource.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1365288#M83236</link>
      <description>&lt;P&gt;`&lt;SPAN&gt;Access-Control-Allow-Origin` is a header configured by the server, not by a client.&amp;nbsp;&amp;nbsp;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin" target="_blank"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 11:19:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/no-access-control-allow-origin-header-is-present/m-p/1365288#M83236</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2024-01-02T11:19:36Z</dc:date>
    </item>
  </channel>
</rss>

