<?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 Cross-domain issue when scripting ArcGIS server administration in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/cross-domain-issue-when-scripting-arcgis-server/m-p/521190#M2482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've dealt with cross-domain issues in the past when using the ArcGIS API for Javascript and Flex (Using a proxy.php and the crossdomain.xml respectively), but I'm unsure how to deal with this one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I created a simple web page so that admin users could easily perform arcgis server task, and I want to use the ArcGIS Server Administrator API to do so from my Javascript in the page.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the typical error message I get at this moment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
XMLHttpRequest cannot load http://azivm2k8sqlexp:6080/arcgis/admin/generateToken. Origin http://192.168.10.18:86 is not allowed by Access-Control-Allow-Origin. 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I tell the REST API at port 6080 to accept my cross-domain calls?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using ArcGIS Server 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: For now I decided to just add a Proxy rule in my web server's (Apache httpd) configuration that will forward requests appropriately without a cross-domain issue:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
ProxyPass /arcgis http://azivm2k8sqlexp:6080/arcgis
ProxyPassReverse /arcgis http://azivm2k8sqlexp:6080/arcgis
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and I replaced the URL in my javascript code to point to &lt;/SPAN&gt;&lt;A href="http://192.168.10.18:86/arcgis/admin" rel="nofollow noopener noreferrer" target="_blank"&gt;http://192.168.10.18:86/arcgis/admin&lt;/A&gt;&lt;SPAN&gt; instead of &lt;/SPAN&gt;&lt;A href="http://azivm2k8sqlexp:6080/arcgis/admin" rel="nofollow noopener noreferrer" target="_blank"&gt;http://azivm2k8sqlexp:6080/arcgis/admin&lt;/A&gt;&lt;SPAN&gt;. It works, but I dislike this workaround because it would be much simpler for the client to change the ArcGIS server URL (if need be) in the simple config.js file I prepared for them instead of playing with the web server configuration. Will update if I find another solution later. In the meantime, please let me know if there is a simple/better solution then this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:43:57 GMT</pubDate>
    <dc:creator>YohanBienvenue</dc:creator>
    <dc:date>2021-12-11T22:43:57Z</dc:date>
    <item>
      <title>Cross-domain issue when scripting ArcGIS server administration</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/cross-domain-issue-when-scripting-arcgis-server/m-p/521190#M2482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've dealt with cross-domain issues in the past when using the ArcGIS API for Javascript and Flex (Using a proxy.php and the crossdomain.xml respectively), but I'm unsure how to deal with this one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I created a simple web page so that admin users could easily perform arcgis server task, and I want to use the ArcGIS Server Administrator API to do so from my Javascript in the page.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the typical error message I get at this moment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
XMLHttpRequest cannot load http://azivm2k8sqlexp:6080/arcgis/admin/generateToken. Origin http://192.168.10.18:86 is not allowed by Access-Control-Allow-Origin. 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I tell the REST API at port 6080 to accept my cross-domain calls?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using ArcGIS Server 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: For now I decided to just add a Proxy rule in my web server's (Apache httpd) configuration that will forward requests appropriately without a cross-domain issue:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
ProxyPass /arcgis http://azivm2k8sqlexp:6080/arcgis
ProxyPassReverse /arcgis http://azivm2k8sqlexp:6080/arcgis
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and I replaced the URL in my javascript code to point to &lt;/SPAN&gt;&lt;A href="http://192.168.10.18:86/arcgis/admin" rel="nofollow noopener noreferrer" target="_blank"&gt;http://192.168.10.18:86/arcgis/admin&lt;/A&gt;&lt;SPAN&gt; instead of &lt;/SPAN&gt;&lt;A href="http://azivm2k8sqlexp:6080/arcgis/admin" rel="nofollow noopener noreferrer" target="_blank"&gt;http://azivm2k8sqlexp:6080/arcgis/admin&lt;/A&gt;&lt;SPAN&gt;. It works, but I dislike this workaround because it would be much simpler for the client to change the ArcGIS server URL (if need be) in the simple config.js file I prepared for them instead of playing with the web server configuration. Will update if I find another solution later. In the meantime, please let me know if there is a simple/better solution then this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:43:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/cross-domain-issue-when-scripting-arcgis-server/m-p/521190#M2482</guid>
      <dc:creator>YohanBienvenue</dc:creator>
      <dc:date>2021-12-11T22:43:57Z</dc:date>
    </item>
  </channel>
</rss>

