<?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: Using Proxy with JavaScript API 4.0 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505538#M46959</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Might be a bug. I'll pass the info along to the dev team but it would be great if you could contact Esri Support and submit a bug for this problem. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jun 2016 16:36:41 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2016-06-03T16:36:41Z</dc:date>
    <item>
      <title>Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505532#M46953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Has anybody tried using the proxy to access a secure service with the 4.0 JavaScript API?&amp;nbsp; When I use the proxy, I can see in my network traffic that it is properly accessing the service, but nothing is displayed on the map.&amp;nbsp; This indicates the proxy is working fine, but the API isn't then adding the result to the map.&amp;nbsp; I tried with both username/password, and token in my proxy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is pretty boilerplate, but here it is if interested:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;require([
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/Map",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/views/MapView",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/layers/FeatureLayer",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/core/urlUtils",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/config",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "dojo/domReady!"
&amp;nbsp;&amp;nbsp;&amp;nbsp; ], function(Map, MapView, FeatureLayer, urlUtils, esriConfig) {

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var map = new Map({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; basemap: "streets"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var view = new MapView({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; container: "viewDiv",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map: map,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zoom: 10,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; center: [-122.668872, 45.511788]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlUtils.addProxyRule({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proxyUrl: '.&amp;lt;&amp;lt;path to proxy&amp;gt;&amp;gt;',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlPrefix: '&amp;lt;&amp;lt;baseurl to use proxy&amp;gt;&amp;gt;'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureLayer = new FeatureLayer({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: "&amp;lt;&amp;lt;secure feature service&amp;gt;&amp;gt;"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.add(featureLayer);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had to switch back to 3.16, which used the proxy and added the layer perfectly.&amp;nbsp; Oddly enough, if I signed into ArcGIS Server in the same browser, the service would display fine in my 4.0 app. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:10:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505532#M46953</guid>
      <dc:creator>JoshuaTanner2</dc:creator>
      <dc:date>2021-12-11T22:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505533#M46954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ran a quick test using the Esri World Traffic service which requires a proxy and it worked for me. (Edited post to update sample to use secure service url example) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/views/MapView",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/layers/FeatureLayer",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/core/urlUtils",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "dojo/domReady!"
&amp;nbsp;&amp;nbsp;&amp;nbsp; ], function(Map, MapView, FeatureLayer, urlUtils) {




&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlUtils.addProxyRule({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proxyUrl: "../resource_proxy/proxy.php",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlPrefix: "services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Starbucks_Locations"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var map = new Map({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; basemap: "streets"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var layer = new FeatureLayer({
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices.arcgis.com%2FV6ZHFr6zdgNZuVG0%2Farcgis%2Frest%2Fservices%2FStarbucks_Locations%2FFeatureServer%2F0" target="_blank"&gt;https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Starbucks_Locations/FeatureServer/0&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.add(layer);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:10:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505533#M46954</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2021-12-11T22:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505534#M46955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kelly, I was able to get it to work fine adding a secure layer from ArcGIS Online, with a clientID and cilentSecret in the proxy.&amp;nbsp; However I was still not seeing the results on my map using the secure layer from ArcGIS Server.&amp;nbsp; It turns out, the points were being added, but they just didn't know how to render.&amp;nbsp; The points were simple square markers and not picture icons.&amp;nbsp; In Firefox and Chrome, nothing was showing up.&amp;nbsp; In IE, I was able to notice very, very tiny markers with an 'x' in them.&amp;nbsp; It's almost like it was trying to find an image marker but nothing was showing up in the network traffic.&amp;nbsp; My solution was just to define a renderer for the feature layer and not rely on the default symbology from the service:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;featureLayer.renderer = new SimpleRenderer({
&amp;nbsp; symbol: new SimpleMarkerSymbol({
&amp;nbsp;&amp;nbsp;&amp;nbsp; size: 6,
&amp;nbsp;&amp;nbsp;&amp;nbsp; color: "black",
&amp;nbsp;&amp;nbsp;&amp;nbsp; outline: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width: 0.5,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; color: "white"
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp; })
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding the renderer worked and the points are now showing up.&amp;nbsp; I'm using ArcGIS Server 10.3 with a secure service accessed through a .net proxy with username and password.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:10:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505534#M46955</guid>
      <dc:creator>JoshuaTanner2</dc:creator>
      <dc:date>2021-12-11T22:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505535#M46956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to get it to work by specifying my own renderer (see below).&amp;nbsp; For some reason, it would not render the square marker that I had defined on the service.&amp;nbsp; Any idea what might be causing the issue?&amp;nbsp; I can mark the solution below as a correct answer, but it still doesn't determine the underlying issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 18:57:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505535#M46956</guid>
      <dc:creator>JoshuaTanner2</dc:creator>
      <dc:date>2016-06-01T18:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505536#M46957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any errors in the dev console? Can you send me the drawing info from the service? You can find it in the rest services directory for that service. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 19:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505536#M46957</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2016-06-01T19:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505537#M46958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you're on to something.&amp;nbsp; The drawing info is a symbol (image) which is just a red square.&amp;nbsp; In the v3 API, the imageData field is used to put the base64 image symbol on the map.&amp;nbsp; In v4, it would appear that it is using the url and trying to send a separate request back to ArcGIS Server to get the image.&amp;nbsp; This request to get the image is what's causing the issue, as it is not sent through the proxy.&amp;nbsp; No errors are thrown in the dev console, but when I look at the network I see the un-proxied request to retrieve the image that is responding with the redirect URL to sign in.&amp;nbsp; Does that make sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 20:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505537#M46958</guid>
      <dc:creator>JoshuaTanner2</dc:creator>
      <dc:date>2016-06-01T20:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505538#M46959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Might be a bug. I'll pass the info along to the dev team but it would be great if you could contact Esri Support and submit a bug for this problem. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 16:36:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505538#M46959</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2016-06-03T16:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proxy with JavaScript API 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505539#M46960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for helping look at this.&amp;nbsp; I'll submit a ticket with Esri to see if it's a possible bug, or something on my end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2016 15:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-proxy-with-javascript-api-4-0/m-p/505539#M46960</guid>
      <dc:creator>JoshuaTanner2</dc:creator>
      <dc:date>2016-06-08T15:31:36Z</dc:date>
    </item>
  </channel>
</rss>

