Select to view content in your preferred language

Directions Widget .NET Proxy setup problem

905
1
03-17-2014 05:36 AM
LuciHawkins
Frequent Contributor
Hello,

I have been attempting to get the javascript 3.8 api Directions Widget to use .NET proxy for logging in to our "Paid" subscription and have not had any luck.  The example at:   https://developers.arcgis.com/javascript/jssamples/widget_directions_basic.html talks about
This sample uses a helper method, added at v3.4, that defines a proxy for a set of resources. In this example all requests to route.arcgis.com are routed to the specified proxy url.

esri.addProxyRule({   urlPrefix: "route.arcgis.com",   proxyUrl: "/sproxy" });


For demonstration purposes this sample uses a proxy that has been setup to use app logins and OAuth2  so you aren't required to log-in with an ArcGIS Online organizational subscription to run the sample.


So, I know that someone somewhere must have been able to get this to work.  Anyone know how they are doing it?  I have tried everything....  My current Proxy was downloaded from GitHub with a date of 3/17/2014.  My current proxy.config file looks like 
<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
             mustMatch="false">
    <serverUrls>
<serverUrl url="http://gis.fwb.org/"
   matchAll="true"/>
    <serverUrl url="http://route.arcgis.com"
  clientId="pertinent ID is here"
  clientSecret="pertinent Secret is here"
  oauth2Endpoint="https://www.arcgis.com/sharing/oauth2/token"
  rateLimit=600
  rateLimitPeriod=600
  matchAll="true">
</serverUrl>
<serverUrl url="http://services.arcgisonline.com"
                 clientId="pertinent ID is here"
  clientSecret="pertinent Secret is here"
  oauth2Endpoint="https://www.arcgis.com/sharing/oauth2/token"
  rateLimit=600
  rateLimitPeriod=600
  matchAll="true"/>
    </serverUrls>
</ProxyConfig>


When I open my web page, the Sign In dialog appears for the Directions Widget.  If I cancel the Sign In and let the web page finish loading, then attempt to get Route Directions, I am given a 500 Internal Server Error  with a message '600' unexpected token. 

Any and all help will be greatly appreciated. 

Thanks,

Luci
0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor
Hello Luci,

Hard to say what the trouble is, but it sounds like the proxy may not be configured correctly. Have you confirmed that the proxy is healthy by testing a valid URL in the browser?

example: http://pathtoproxy/proxy.ashx?http://www.esri.com

Other things to consider:
1) If you watch the web traffic when the application loads, do you see successful calls to the proxy page?
2) Is the path to the proxy page correct in the JavaScript code?

Hope this helps!

-Noah
0 Kudos