I'm developing a Web Application that is using the ArcGIS Javascript API. When adding a Feature Layer I'm using the setDefinitionExpression to limit the features that are returned. The expression used can be quite large (greater than 2000 in length). Because the expression can be large, I am attempting to use the Proxy page, however I am seeing unusual results. I am finding that the proxy page is not always used, even though I am using the exact same query expression. I have conformed this by utilizing IE's debugger tool and also using Fiddler.

In my application if I add 2 layers (Tiled and Dynamic) prior to adding the Feature Layer I consistently see that the Proxy page is not being used. I can see via the debugging tools that a POST is being performed directly to my REST service. The content-length is over 6000.

If I add just the Tiled layer prior to adding the Feature Layer, I can see that an attempt is made to use the Proxy page. The proxy page is having issues, therefore my Feature Layer does not get added.

Can someone please explain why the Proxy page is not always used even though it would seem that it should be, given the length of the query string used in the setDefinitionExpession. I am very confused as to why layers added prior to adding a Feature Layer would affect the use of the proxy and why adding the Feature Layer doesn't fail when the proxy is not used.

The first function below shows where I am setting the esriConfig.defaults. The second section of code is from my class (tpsMap) where I am adding a Feature layer.

    function (tpsMap, esriConfig) {

        // Setup Esri Config
        esriConfig.defaults.io.proxyUrl = "http://phunt-pc/EsriProxy/proxy.ashx"
        esriConfig.defaults.io.alwaysUseProxy = false;

        // Create and display Map
        tpsMap = new tpsMap(oMapConfiguration);
        tpsMap.mapQuery = oMapQuery;

this._featureLayer = new FeatureLayer(this.mapQuery.FeatureLayer.url,

            mode: FeatureLayer.MODE_SNAPSHOT,
            opacity: 0.50,
            infoTemplate:    this._getInfoTemplate(this.mapQuery.FeatureLayer.InfoTemplate),
            outFields: this.mapQuery.FeatureLayer.OutputFields,                                       
            className: "feature"

       // Limit the features based on the expession

  • 1
    Do you have any sample code?
    – Branco
    Commented Mar 31, 2015 at 19:15
  • I've added sample code in my original post above.
    – Peter
    Commented Mar 31, 2015 at 20:33

1 Answer 1


my best bet is that adding other layers from the same ArcGIS Server instance is triggering a CORS check by the JSAPI and that since both the server and your browser support CORS, the proxy isn't necessary.


Your Answer

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

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