<?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: Same-origin policy: Why this code runs properly? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554584#M51706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A1: ArcGIS Server has CORS setup by default and accepts any origin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A2: You should consider using ArcGIS Web adaptor. Then you could have both ArcGIS Server and Web apps on the same port + the real AGS hostname is hidden from the public. You also could, of course do nothing about it and leave it as is and it'll work fine ;]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 May 2014 10:24:14 GMT</pubDate>
    <dc:creator>JakubMalec</dc:creator>
    <dc:date>2014-05-27T10:24:14Z</dc:date>
    <item>
      <title>Same-origin policy: Why this code runs properly?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554583#M51705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've installed ArcGIS Server with its default configuration (no web adaptor), then put Javascript API and the following code in the "C:\Inetpub\www" &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 &amp;lt;script src="http://localhost/arcgis_js_api/library/3.9/3.9/init.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var map;
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; require(["esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/domReady!"], 
&amp;nbsp;&amp;nbsp; function(Map, ArcGISDynamicMapServiceLayer) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = new Map("map", {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; center: [0,0], 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zoom: 3,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sliderStyle: "small"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp; 
&amp;nbsp;&amp;nbsp; var layer = new ArcGISDynamicMapServiceLayer(
&amp;nbsp; "http://localhost:6080/arcgis/rest/services/SampleWorldCities/MapServer",{"opacity":0.5}); 
&amp;nbsp; 
&amp;nbsp; map.addLayer(layer);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is just the script part of webpage. When i call this page via localhost (i.e. &lt;/SPAN&gt;&lt;A href="http://localhost/mypage.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://localhost/mypage.html&lt;/A&gt;&lt;SPAN&gt;), this code runs properly and gives me the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But according to what i understood from Same-origin policy, it must not work. Simply because above code calls a layer which has different port (6080) from the caller page (which is 80).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Q1: what i'm wrong about? or what i don't understand correctly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Q2: If i wanna use built-in web server (port 6080), where i have to put my pages?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:57:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554583#M51705</guid>
      <dc:creator>BaghdadAlAlavi</dc:creator>
      <dc:date>2021-12-11T23:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Same-origin policy: Why this code runs properly?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554584#M51706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A1: ArcGIS Server has CORS setup by default and accepts any origin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A2: You should consider using ArcGIS Web adaptor. Then you could have both ArcGIS Server and Web apps on the same port + the real AGS hostname is hidden from the public. You also could, of course do nothing about it and leave it as is and it'll work fine ;]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 10:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554584#M51706</guid>
      <dc:creator>JakubMalec</dc:creator>
      <dc:date>2014-05-27T10:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Same-origin policy: Why this code runs properly?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554585#M51707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I installed web adaptor but still i can use the above page with 6080 port. Why?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, now i can remove 6080 from links and everything goes fine. but why 6080 is still available?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I mean, someone outside may make a direct connection to arcgis server using 6080 port and access all data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 18:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554585#M51707</guid>
      <dc:creator>BaghdadAlAlavi</dc:creator>
      <dc:date>2014-05-27T18:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Same-origin policy: Why this code runs properly?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554586#M51708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Web Adaptor just filters and forwards all the requests to the arcgis server which operates on its own port (6080 in your case). So, the AGS still needs to operate on its own port.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;People can access all your data through the Web Adaptor, except for the AGS' admin directory (Web Adaptor just filters out requests going to AGS admin directory). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you can do is deny any incomming traffic to port 6080 on your firewall (leaving the ability to access AGS on port 6080 only from localhost).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 08:28:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/same-origin-policy-why-this-code-runs-properly/m-p/554586#M51708</guid>
      <dc:creator>JakubMalec</dc:creator>
      <dc:date>2014-05-28T08:28:30Z</dc:date>
    </item>
  </channel>
</rss>

