<?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: How do I access cross-domain resources in a local WAB app? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853518#M11121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Robert for your quick and helpful response! I was using fetch, which doesn't seem to support proxy use, but I switched to using esriRequest and it worked!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Feb 2020 20:38:28 GMT</pubDate>
    <dc:creator>VanessaKing</dc:creator>
    <dc:date>2020-02-13T20:38:28Z</dc:date>
    <item>
      <title>How do I access cross-domain resources in a local WAB app?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853516#M11119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a WAB app that hasn't been deployed yet; it's just running locally. I'm writing a custom widget that needs to access data from an API. I'm getting an error of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access to fetch at '[API URL]' from origin 'https://[My Machine Name]:[Port]' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions on how to fix this?&amp;nbsp;Most of&amp;nbsp; the information I've found on this refers to deployed apps. I saw one suggestion to use an open-source proxy (e.g.&amp;nbsp;&lt;A class="link-titled" href="https://cors-anywhere.herokuapp.com/" title="https://cors-anywhere.herokuapp.com/"&gt;https://cors-anywhere.herokuapp.com/&lt;/A&gt;) but I don't think that will work, because the API is only accessible on my organization's network.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2020 19:56:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853516#M11119</guid>
      <dc:creator>VanessaKing</dc:creator>
      <dc:date>2020-02-13T19:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access cross-domain resources in a local WAB app?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853517#M11120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your widget using a esriRequest class to access the API data? If so then you need to configure it to use the proxy. Here is an example of how I do it:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; requestHandle &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;esriRequest&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
          url&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'https://myapiurl'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
          content&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            ppin&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ppin&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            f&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'json'&lt;/SPAN&gt;
          &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
          handleAs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"json"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
          timeout&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;10000&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;useProxy&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; usePost&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;false&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; disableIdentityLookup&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:31:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853517#M11120</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T10:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access cross-domain resources in a local WAB app?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853518#M11121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Robert for your quick and helpful response! I was using fetch, which doesn't seem to support proxy use, but I switched to using esriRequest and it worked!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2020 20:38:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-do-i-access-cross-domain-resources-in-a-local/m-p/853518#M11121</guid>
      <dc:creator>VanessaKing</dc:creator>
      <dc:date>2020-02-13T20:38:28Z</dc:date>
    </item>
  </channel>
</rss>

