AnsweredAssumed Answered

How to use proxy for directions widget?

Question asked by shakiltmbc on Oct 11, 2018

My directions widget currently reads `There seems to have been an error.`

I've added my widget and added these proxy rules in my JS

 

urlUtils.addProxyRule({
urlPrefix: "route.arcgis.com",
proxyUrl: "http://localhost:88/ArcGIS/PHP/proxy.php"
});
urlUtils.addProxyRule({
urlPrefix: "traffic.arcgis.com",
proxyUrl: "http://localhost:88/ArcGIS/PHP/proxy.php"
});

 

My `proxy.config` file:

 

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
logFile="proxy_log.log"
mustMatch="true">
<serverUrls>
<serverUrl url="http://services.arcgisonline.com"
username="*****"
password="*****"
matchAll="true"/>
<serverUrl url="https://route.arcgis.com/"
username="*****"
password="*****"
matchAll="true"/>
</serverUrls>
</ProxyConfig>

 

My `proxy_log.log` file shows:

 

10-10-18 17:06:25 | GET detected
10-10-18 17:06:25 | Resource using ArcGIS Server security


For each attempt

 

Testing my proxy with `http://localhost:88/ArcGIS/PHP/proxy.php?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson`

 

returns

 

`{"error":{"code":502,"details":["cURL error (7): Failed to connect to services.arcgisonline.com port 80: Timed out."],"message":"Proxy failed due to curl error."}}`

Outcomes