Proxy giving error 500

7438
11
01-20-2016 06:37 AM
ADITYAKUMAR1
Occasional Contributor III

Hi Users,

i am trying to configure the proxy but its giving me error.

{error: {code: 500,message:"Unable to connect to the remote server http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson"}}

At the same time if I uses http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson, it gives me result.

Following is my proxy.

<?xml version="1.0" encoding="utf-8" ?>

<ProxyConfig allowedReferers="*"

             mustMatch="true">

    <serverUrls>

        <serverUrl url="http://services.arcgisonline.com"

                   matchAll="true"/>

  <serverUrl url="https://xxxxxxxxxxxx.com/ArcGIS/rest/services/Global/2D_GE_GSI_2D_SHELL/MapServer"

                   matchAll="true"/>

   

  <serverUrl url="https://xxxxxxxxxxxxxx.com/ArcGIS/rest/services/Global/2D_GE_GSI_3D/MapServer"

                   matchAll="true"/>

  <serverUrl url="https://xxxxxxxxxxxxxx.com/arcgis/rest/services/Global/2D_DREAM_EPE/MapServer"

                   matchAll="true"/>

  <serverUrl url="https://xxxxxxxxxxxxxxx.com/arcgis/rest/services/Global/2D_DREAM_EPE/MapServer/3"

                   matchAll="true"/>

   

    </serverUrls>

</ProxyConfig>

The version of .NET used is 4.0.

I am using TOC widget in my application and here I can see the esri data coming in my TOC widget but for rest its giving error

Unable to load http://www.arcgis.com/sharing/tools…bal/2D_GE_GSI_2D_SHELL/MapServer&f=json

{"error":{"code":500,"message":"Unable to generate legends: Unable to update legend cache, invalid input parameters"}}

I am suspecting it to be a proxy issue.

Please help me on this.

Thanks

Aditya Kumar

0 Kudos
11 Replies
ArtemisFili
Esri Contributor

I understand that when you hit this url http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson  directly on the browser, it works just fine. However, it does not work when you use it through the proxy. Did you try hitting this url using a browser on the server machine where the proxy is hosted? It looks like the server machine where the proxy is hosted is not able to communicate with the remote resource. This could happen if the firewall is blocking the communication or if there are any other network configurations that are blocking the communications with specific external urls. 

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

Hi Artemis,

Thanks for the reply. I tried hitting the url on the server machine where the proxy is hosted and I am getting the data.

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

Hi Artemis,

  There is one more observation I would like to share with you.

I am adding this line  esriConfig.defaults.io.corsEnabledServers.push("https://mapserver1.XXX.com");

When I am uncommenting this line I cannot see the layer from my server and those layers are not even coming in my TOC widget but the default arcgis layers are coming.

with_proxy.png

And when I comment the layer, I can find my data on the screen but none of the layers are into TOC.without_proxy.png

Hope this will help to understand the issue better.

Thanks

Aditya Kumar

0 Kudos
ArtemisFili
Esri Contributor

It looks like the request for the TOC is http://www.arcgis.com/sharing/tools…bal/2D_GE_GSI_2D_SHELL/MapServer&f=json ​ so could it be that the server machine cannot access http://www.arcgis.com?

Also is your javascript application hosted on the same web server with the proxy? This two should be side-by-side on the same server.

ADITYAKUMAR1
Occasional Contributor III

Hi Artemis,

  Sorry for the late reply.

I added the print functionality to the map and the same issue is being faced there as well.

When proxy is active the  print is working else the print is not working.

For me the arcgis server is somewhere else.I am provided with the map service url and I am just consuming the.

Thanks

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

Hi Artemis,

  I cross checked again and its 100% proxy issue.

Thanks

Aditya

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

Hi Artemis,

I have put the application and the proxy at the same location but the problem still hold the same.

0 Kudos
ArtemisFili
Esri Contributor

Hi Aditya,

Is the server https://mapserver1.xxx.com/  CORS enabled?

The issue could be that the server is not CORS enabled so the proxy is required to bypass the cross domain limitation. But when you add  esriConfig.defaults.io.corsEnabledServers.push("https://mapserver1.XXX.com"); the proxy will not be used and as a result the layer will not show up because the cross domain request fails.

If the server is not CORS enabled, you could try enabling CORS so that a cross domain request will be allowed without relying on a proxy page.

ADITYAKUMAR1
Occasional Contributor III

Hi Artemis,

I am yet to check if its CORS enabled. But we still need to use default services of ESRI like for print,geometry services which are not able to consume due to this problem.

Thanks

Aditya Kumar

0 Kudos