proxy page - how can I tell the length of the URL?

927
9
04-02-2014 08:56 AM
MikeSteven
New Contributor III
Hi,

I'm an ArcGIS Server Javascript API application that uses the buffer operation to buffer a point by 35m and finds features within that distance. The javascript API documentation recommends using a proxy page if doing buffer operations but then in the part in the javascript API documentation that explains the proxy page it says ???Common scenarios where you may run into URL length issues are when you use the buffer from a complex polygon as the input to a query task???. If I???m only buffering a point then would that run the risk of running into URL length issues? What is the URL that would be potentially long? And how can I test the length of the URL being created?

Cheers,
Mike
0 Kudos
9 Replies
RobertoPepato
Occasional Contributor II
Mike,

In fact you can easily get into this scenario if you, for example, are bufferizing a irregular polygon with many vertices and inner holes. This kind of geometry needs to be serialized according to the rest specification. Polygons contains rings and rings contains points. If you have many rings and points, you'll see this kind of problem in action.

Regards,

Roberto Pepato
0 Kudos
TracySchloss
Frequent Contributor
Even though you are buffering a point, the resultant buffer is a polygon.  You will have a large number of coordinates from that process, so no matter what you are buffering, you'll have to set up the proxy.
0 Kudos
RobertoPepato
Occasional Contributor II
Even though you are buffering a point, the resultant buffer is a polygon.  You will have a large number of coordinates from that process, so no matter what you are buffering, you'll have to set up the proxy.


In that case, the serialized buffer is sent through the response body, right?

I think that Mike is trying to understand how to deal with the GET/POST verb on the request, because of the limitations on the size of a querystring when using GET requests. Let me know if I got something wrong.

Regards,

Roberto Pepato
0 Kudos
TimCollyer
Occasional Contributor
To answer the original question, the maximum url length depends on your browser.

In IE it's 2,083 characters. http://support.microsoft.com/kb/208427

And the easiest way to check the length of the url being created is in the developer tools/console of whatever browser you are using.
0 Kudos
MikeSteven
New Contributor III
Thanks for your replies. I've got one or two more questions. The maps that will perform the buffer have to be accessed via https without any certificate warnings. How can I be sure the proxy is working correctly? I've followed the instructions on github but when I go check the proxy is able to forward request directly in the browser I get a 403 error message saying access is denied:

https://edinburghcouncilmaps.info/proxy/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/serv...

Any ideas why this might be?

I also don't really understand the bit on github where it gives a javascript example for requests to route.arcgis.com

    urlUtils.addProxyRule({
        urlPrefix: "route.arcgis.com",
        proxyUrl: "http://[yourmachine]/proxy/proxy.ashx"
    });


When I set-up a proxy on a different server a few months ago the instructions I followed just said to add this line into the javascript:

esriConfig.defaults.io.proxyUrl = "/proxy";


Is this enough or do I need to do the addProxyRule?

Cheers,
Mike
0 Kudos
MichaelVolz
Esteemed Contributor
Mike:

I ran into this exact same issue, so I opened an incident with ESRI.  The answer is to provide the full URL to your specific proxy page that would go something like:  http://"Server Name"/Proxy/proxy.ashx

The url assumes you put the proxy files into a folder called Proxy on your IIS server at c:\inetpub\wwwroot.

This is where I feel ESRI's documentation is lacking as they use a shorthand path of "/proxy" because of how they set their own IIS server up.

I hope this information helps you.
0 Kudos
MikeSteven
New Contributor III
Thanks Michael.

Yesterday I'd misunderstood the instructions for testing this link:

http://[yourmachine]/DotNet/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjso...

and today I can see that this is working.

I have another question though - how can I test that the proxy is working in my javascript application? In my javascript application the buffer operation was completing successfully before I put in the proxy reference. If I look in the developer tools at the network requests it says:

Request URL:https://edinburghcouncilmaps.info/arcgis/rest/services/Utilities/Geometry/GeometryServer/buffer?f=js...
Request Method:GET

Should the request method not say POST?

Cheers
0 Kudos
TimCollyer
Occasional Contributor
Yep, it should log as a POST request, and it should display like "http://urltoproxy/proxy.jsp?http://urltoarcgis/services?allyourparameters=12345

I would say it's not going via your proxy because that url isn't exceeding the ~2000 character length restriction (or whatever it is for your browser).

You could set "alwaysUseProxy" to ensure that your proxy is always called if you want to test it is working.

https://developers.arcgis.com/javascript/jshelp/inside_defaults.html
0 Kudos
MikeSteven
New Contributor III
I'm coming back to this because I never got it sorted before. I've got the reference to the proxy in my code. If I don't include the line

esriConfig.defaults.io.alwaysUseProxy = true;

then the buffer operation executes using GET.

If I include the flag to set alwaysUseProxy to be true I can see that the requests for loading my ArcGISTiledMapServiceLayer tiles are going through the proxy, however the buffer operation doesn't execute (the buffer doesn't appear in the network requests and there aren't any errors in the console). Any suggestions how I can work out what's going on?

Cheers
0 Kudos