5

I am trying to set up the proxy for my web application because the request exceeds 2000 characters. I set up the proxy as described in ESRI site. When I run my application I get the error as shown below

**"Unable to load http://localhost/proxy.ashx?http://T...nction/execute Status:403"**

I put my web application (one HTML page with javascript api code) and the two proxy files to my development machine's root folder. This machine is XP.

I have Geoprocessing service running on another machine (TestServer). When the length of GP request exceeds the limit, the application tries to use proxy and that is when I see the error above. This machine is Win 2008.

Status 403 is Forbidden page error.

1

2 Answers 2

3

Have you created an application, in IIS manager, using the folder that the proxy is located? If the folder is say agsproxy then you would have

http://localhost/agsproxy/proxy.ashx?

In the javascript, you would have

esri.config.defaults.io.proxyUrl = "/agsproxy/proxy.ashx";

You may want to use CORS though now.. removing the need for proxy (better performance)

//add CORS servers
esri.config.defaults.io.corsEnabledServers.push("YOURTESTSERVER");
esri.config.defaults.io.corsEnabledServers.push("sampleserver1a.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("sampleserver6.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("tasks.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("server.arcgisonline.com");
5
  • Thank for the response. Yes I did create the application in IIS Manager as described in ESRI site. I tried by have in the files in IIS rootfolder and also in another folder created as application. None of these seems to work. What is CORS? How do I use in Javascript API page? Let me do some research? Any ESRI document on this? Is there anything to do with proxy and Geoprocessing Service call?
    – Cyril
    Mar 15, 2013 at 20:12
  • 1
    Just add the above CORS line in your initialize function (init()) and that's it! help.arcgis.com/en/webapi/javascript/arcgis/jssamples/…
    – awesomo
    Mar 15, 2013 at 21:33
  • I get javascript error esri.config.defaults.io.corsEnabledServers is null. Then I tried esri.config.defaults.io.corsEnabledServers = ['vdev03:6080/'];and esri.config.defaults.io.corsEnabledServers = ['vdev03']; Did not work.
    – Cyril
    Mar 16, 2013 at 3:54
  • You should push onto the array because there are a few esri servers by default added. esri.config.defaults.io.corsEnabledServers.push('vdev03:6080');
    – awesomo
    Mar 18, 2013 at 16:54
  • I am getting "status: 0" , could you please help me on this
    – Saj
    Jan 27, 2017 at 13:02
0

You must add the final destination URL to the proxy.config file for the proxy handler. If you don't, it will respond with a 403 Forbidden code.

If "mustMatch" and "matchAll" are both set to true, then the proxy page will determine if the URL to be proxied starts with the same text as the serverUrl in configuration. You may need to prefix the URL with the protocol, e.g. https://myserver.com/arcgis.

4
  • Thanks for responding. I do have the full path. I tried with and without /execute at the end. /exiecute is added by the GP service exceute method. <serverUrl url="vdev03:6080/arcgis/rest/services/MapLegalDescriptionFunction/…" matchAll="false"></serverUrl></serverUrl> </serverUrls>
    – Cyril
    Mar 15, 2013 at 19:35
  • Since matchAll is false, the proxy page is doing a full string comparison - you should use the full URL that is being passed to proxy.ashx for the url argument.
    – mwalker
    Mar 15, 2013 at 20:17
  • I had already tested with both MatchAll and MustMatch as true. It did not help me.
    – Cyril
    Mar 16, 2013 at 3:54
  • If the line in the above comment is a copy-and-paste, then you still need to put http:// at the beginning of the url.
    – mwalker
    Mar 18, 2013 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.