Select to view content in your preferred language

Facing errors while requesting for routing service

1799
3
11-23-2016 03:57 AM
SanketPimple
Deactivated User

I'm using the sample code for Routing task to check before I buy. I have set up the proxy server and I'm giving some hardcoded latitude - longitude pairs in the code instead of clicking on the map.

I am able to see the routes for 11 points successfully but if i input more than 11 points, I am facing the following errors:

Response for preflight has invalid HTTP status code 403

Reason: CORS header 'Access-Control-Allow-Origin' missing

And  How do I use CORS in the code?

#routing services#javascript app

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Sanket,

   Have you verified that you are making requests through the proxy. The reason I ask is you normally do not have to worry about CORs when using a proxy. Can you share your code for review?

0 Kudos
SanketPimple
Deactivated User
Yes I'm using a proxy.
Below is the proxy.config file
<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*"
                logFile="proxy_log.log"
                logLevel="INFO"
                mustMatch="true">
  <serverUrls>
    <serverUrl url="http://services.arcgisonline.com"
        matchAll="true"/>
<serverUrl url="http://route.arcgis.com"
   clientId=<id>
   clientSecret=<secret>
   username="username"
   password="password"
   matchAll="true">
</serverUrl>
  </serverUrls>
</ProxyConfig>
<!-- See https://github.com/Esri/resource-proxy for more information -->
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sanket,

   You use username and password or clientid and appsecret not both.