Directions Widget Proxy

229
5
Jump to solution
02-26-2019 02:18 PM
JaredPilbeam2
MVP Regular Contributor

I want to use the Directions widget in a custom app. I'm using 4.9. To avoid the prompt to sign in I'm setting up the proxy. 

-Tested the DotNet proxy. It works. 

-Put in the relevant code as such:

require(["esri/core/urlUtils"], function(urlUtils) {
  urlUtils.addProxyRule({
    urlPrefix: "route.arcgis.com",
    proxyUrl: "https://webapp.willcountyillinois.com/DotNet/proxy.ashx"
  });
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Got the following error on Chrome console. The widget isn't working. Not sure why.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Add the server url tag for that url.

<serverUrl url="https://route.arcgis.com" username="blah" password="blah" rateLimit="600" rateLimitPeriod="60" matchAll="true"/>

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Jared,

  Have you added the route.arcgis.com to your proxy.config?

JaredPilbeam2
MVP Regular Contributor
<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
             mustMatch="true">
    <serverUrls>
        <serverUrl url="http://services.arcgisonline.com"
                   matchAll="true"/>
    </serverUrls>
</ProxyConfig>

Robert,

Here's the content of the config file. How would I do that?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Add the server url tag for that url.

<serverUrl url="https://route.arcgis.com" username="blah" password="blah" rateLimit="600" rateLimitPeriod="60" matchAll="true"/>

RobertScheitlin__GISP
MVP Esteemed Contributor

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos
JaredPilbeam2
MVP Regular Contributor

Robert,

Thanks, I marked your latest reply as correct. I added the route url as you pointed out. It was still throwing the same error in the Chrome console. On top of that, I had to add two more <serverUrl> tags in the config file to get it to work. One was for my organisation's AGOL account and the other was to ArcGIS REST services url. I had to create a new app at ArcGIS for Developers so that I could obtain a ClientID and ClientSecret. See code from config file below.

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
             mustMatch="true">
    <serverUrls>
        <serverUrl url="https://willcountygis.maps.arcgis.com" username="blabla" password="blabla" rateLimit="600" rateLimitPeriod="60" 
                   matchAll="true"/>
                    <serverUrl url="https://route.arcgis.com/" username="blabla" password="blabla" rateLimit="600" rateLimitPeriod="60" 
                   matchAll="true"/>
                   <serverUrl url="https://services.arcgis.com/" clientid="blabla" clientSecret="blabla" rateLimit="600" rateLimitPeriod="60" 
                   matchAll="true"/>
    </serverUrls>
</ProxyConfig>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos