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.
Solved! Go to Solution.
Add the server url tag for that url.
<serverUrl url="https://route.arcgis.com" username="blah" password="blah" rateLimit="600" rateLimitPeriod="60" matchAll="true"/>
Jared,
Have you added the route.arcgis.com to your proxy.config?
<?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?
Add the server url tag for that url.
<serverUrl url="https://route.arcgis.com" username="blah" password="blah" rateLimit="600" rateLimitPeriod="60" matchAll="true"/>
Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.
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>