AnsweredAssumed Answered

Configure proxy

Question asked by CCweedcontrol on Oct 20, 2016
Latest reply on Jan 5, 2017 by aug_aug

I am trying to config a proxy. I have features that are hosted on arcgis online. I have imagery with lables, world transportation, usa Cropland and a feature layer on a map on arcgis online that i set as my map on Web AppBuilder for Arcgis. I created a web application with Web AppBuilder for Arcgis. I download the application and move the app folder to wwwroot folder. I download the proxy file from github.com/Esri/resource-proxy/releases. I copied the DotNet folder in the wwwroot folder and i converted the folder to an application and set applicaiton pool to ASP.NET V4.0. I then opened the proxy.config and entered the services as follows. 

 

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


<serverUrl url="http://XXXXXXXXXX.maps.arcgis.com"
clientId="XXXXXXXXXX"
clientSecret="XXXXXXXXXXXXXXXXXXXX"
oauth2Endpoint="https://XXXXXXXXXX.maps.arcgis.com/sharing/oauth2/"
matchAll="true">
</serverUrl>

<serverUrl url="https://services6.arcgis.com/885XQwwhV5bcCoLj/ArcGIS/rest/services"
clientId="XXXXXXXXXX"
clientSecret="XXXXXXXXXXXXXXXXXXXXf"
oauth2Endpoint="https://XXXXXXXXXX.maps.arcgis.com/sharing/oauth2/"
matchAll="true"/>


</serverUrls>

 


</ProxyConfig>

<!-- See https://github.com/Esri/resource-proxy for more information -->

 

my config.json parameters 

 

"wabVersion": "2.1",
"isTemplateApp": true,
"isWebTier": false,
"httpProxy": {
"useProxy": true,
"url": "",
"alwaysUseProxy": false,
"rules": [{
"urlPrefix": "http://XXXXXXX.maps.arcgis.com/sharing/rest",
"proxyUrl": "http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashx"
},
{
"urlPrefix": "http://services6.arcgis.com/885XQwwhV5bcCoLj/ArcGIS/rest/services",
"proxyUrl": "http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashx"
}
]

}
}

 

I get the following error.

 

XMLHttpRequest cannot load http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashx?http://XXXXXX.maps.arcgis.com/sharing/rest/portals/self?f=json&dojo.preventCache=1476978719639. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
init.js:89 n {message: "Unable to load http://XXXXX.XXXXXXXX.XXXg/DotNet/pr…?f=json&dojo.preventCache=1476978719639 status: 0", response: Object, status: 0, responseText: "", xhr: XMLHttpRequest…}_ssl: undefinedlog: undefinedmessage: "Unable to load http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashx?http://2cweeds.maps.arcgis.com/sharing/rest/portals/self?f=json&dojo.preventCache=1476978719639 status: 0"response: ObjectresponseText: ""stack: (...)get stack: stack()set stack: stack()status: 0xhr: XMLHttpRequest__proto__: Errorw @ init.js:89(anonymous function) @ init.js:88c @ init.js:103d @ init.js:103resolve.callback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105(anonymous function) @ init.js:92h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109n @ init.js:138f @ init.js:142
portalUtils.js?wab_dv=2.1:73 n {message: "Unable to load http:/XXXXX.XXXXXXXX.XXX/DotNet/pr…?f=json&dojo.preventCache=1476978719639 status: 0", response: Object, status: 0, responseText: "", xhr: XMLHttpRequest…}_ssl: undefinedlog: undefinedmessage: "Unable to load http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashx?http://XXXXXXX.maps.arcgis.com/sharing/rest/portals/self?f=json&dojo.preventCache=1476978719639 status: 0"response: ObjectresponseText: ""stack: (...)get stack: stack()set stack: stack()status: 0xhr: XMLHttpRequest__proto__: Error(anonymous function) @ portalUtils.js?wab_dv=2.1:73(anonymous function) @ init.js:63c @ init.js:103d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105(anonymous function) @ init.js:867c @ init.js:103d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103resolve.callback @ init.js:105c @ init.js:104d @ init.js:103resolve.callback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105(anonymous function) @ init.js:92h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109n @ init.js:138f @ init.js:142

 

I can ping the proxy (http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashx?ping ) i get 

{ "Proxy Version": "1.1.0", "Configuration File": "OK", "Log File": "Not Exist/Readable"}

with http://XXXXX.XXXXXXXX.XXX/DotNet/proxy.ashxhttps://services6.arcgis.com/885XQwwhV5bcCoLj/ArcGIS/rest/services  i get.

ArcGIS REST Services Directory

Folder: /

Current Version: 10.41

 

Services:
L

HTTP Error 500.19 - Internal Server Error

 

I need some serious help please.

Outcomes