Below is simple code to add a secure webmap into a MapView. This issue is that the proxy URL in not pre-pending to the Portal item URL. Instead I get the login dialog.
I expect to see a URL like this in my network traffic:
https://MY_PROXY_URL/EsriResourceProxy/proxy.ashx?https://MY_PORTAL_URL/portal/sharing/rest/content/items/4b0a97623245423fb3cbdfb321f0970e which successfully returns content in the browser. This indicates that the proxy is properly configured and the values in proxy.config are correct.
Instead, I see native URLs like this in my network traffic:
https://MY_PORTAL_URL/portal/sharing/rest/content/items/4b0a97623245423fb3cbdfb321f0970e which informs me that I do not have permissions.
So, my question is: how do I get my JS to format the request Url to be pre-pended with the proxy URL?
TIA
<SPAN class="operator token"><</SPAN>script<SPAN class="operator token">></SPAN>
<SPAN class="token function">require</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>
<SPAN class="string token">"esri/views/MapView"</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"esri/WebMap"</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">"esri/config"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>
MapView<SPAN class="punctuation token">,</SPAN>
WebMap<SPAN class="punctuation token">,</SPAN>
esriConfig<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
esriConfig<SPAN class="punctuation token">.</SPAN>request<SPAN class="punctuation token">.</SPAN>proxyUrl <SPAN class="operator token">=</SPAN> <SPAN class="string token">"https://MY_PROXY_DOMAIN/EsriResourceProxy/proxy.ashx"</SPAN><SPAN class="punctuation token">;</SPAN>
esriConfig<SPAN class="punctuation token">.</SPAN>portalUrl <SPAN class="operator token">=</SPAN> <SPAN class="string token">"https://MY_PORTAL_DOMAIN/portal"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> webmap <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">WebMap</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
portalItem<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN>
id<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"4b0a97623245423fb3cbdfb321f0970e"</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> view <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MapView</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
map<SPAN class="punctuation token">:</SPAN> webmap<SPAN class="punctuation token">,</SPAN>
container<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"viewDiv"</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token"><</SPAN><SPAN class="operator token">/</SPAN>script<SPAN class="operator token">></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>