SirReelMX

Use Proxy with large definition expression, js api sending GET and not using proxy...

Discussion created by SirReelMX on Nov 8, 2013
I'm trying to set a definition expression for a FeatureLayer, and from looking at the generated request, the size is over the 2048 character limit. Ok, no problem, setup a proxy. However, when I do setup the proxy, the request is still going directly to the map service and not going through the proxy page. In an attempt to see what is going on, I set the alwaysUseProxy to true to force it. Now, it is calling the proxy, but it's calling it via a GET request instead of a POST which causes IIS to return a 403 error with the following message "Due to the presence of characters known to be used in Cross Site Scripting attacks, access is forbidden.  This web site does not allow Urls which might include embedded HTML tags"
I'm guessing that if it was a POST it might work, but I can't seem to figure out why it's using GET instead, or why when I don't have the alwaysUseProxy set that it doesn't try to use the proxy when it should due to the large size of the query string. Any ideas?

Heres the section of my code where I set the proxy page:

require(['esri/config','esri/map','esri/dijit/BasemapGallery', 'esri/dijit/Basemap', 'esri/dijit/BasemapLayer','esri/layers/ArcGISTiledMapServiceLayer','esri/layers/FeatureLayer','esri/tasks/query','esri/tasks/QueryTask','esri/symbols/SimpleFillSymbol','esri/symbols/SimpleLineSymbol','esri/renderers/SimpleRenderer','esri/graphic','esri/lang','esri/graphicsUtils','dojo/_base/Color','dojo/number','dojo/dom-style','dijit/TooltipDialog','dijit/popup', 'dojo/parser', 'dojo/query','dijit/layout/BorderContainer','dijit/layout/ContentPane','dijit/TitlePane','dojo/domReady!'], function(esriConfig,Map,BasemapGallery, Basemap, BasemapLayer,ArcGISTiledMapServiceLayer,FeatureLayer,Query,QueryTask,SimpleFillSymbol,SimpleLineSymbol,SimpleRenderer,Graphic,esriLang,graphicsUtils,Color,number,domStyle,TooltipDialog,dijitPopup,parser,dojoQuery) {
  parser.parse();


  esriConfig.defaults.io.proxyUrl = 'proxy.ashx';


Here is the request that is generated:

http://arcgisserver/ArcGIS/rest/services/Boundaries/MapServer/5/query?f=json&where=CLLI%20IN%20(%27ABRDMDAB%27%2C%27ALTWMDAT%27%2C%27ANNPMDAN%27%2C%27ARBTMDAR%27%2C%27ARMGMDAR%27%2C%27BLARMDBL%27%2C%27BLTMMDCH%27%2C%27BLTMMDED%27%2C%27BLTMMDUV%27%2C%27BLTMMDWL%27%2C%27BOWIMDBO%27%2C%27BRKLMDBK%27%2C%27BRNDMDBE%27%2C%27BRRDMDBR%27%2C%27BRWKMDBR%27%2C%27BTHSMDBD%27%2C%27BTHSMDWA%27%2C%27BTHSMDWW%27%2C%27BTVLMDBV%27%2C%27CHASMDCH%27%2C%27CHCHMDBE%27%2C%27CLMAMDCB%27%2C%27CLMAMDOB%27%2C%27CLMAMDSR%27%2C%27CLPKMDBW%27%2C%27CLTNMDCL%27%2C%27CLVLMDCE%27%2C%27COTNMDCR%27%2C%27CPHGMDCA%27%2C%27CTVLMDCT%27%2C%27CYVLMDCK%27%2C%27CYVLMDDA%27%2C%27DMSCMDDE%27%2C%27DNDLMDDN%27%2C%27DRCRMDDC%27%2C%27EDWDMDEG%27%2C%27EKRGMDEL%27%2C%27ELCYMDEL%27%2C%27ESSXMDEX%27%2C%27FDBGMDFE%27%2C%27FPATMDFR%27%2C%27FRDRMDFR%27%2C%27FTWSMDCP%27%2C%27GLBRMDGL%27%2C%27GLVLMDGL%27%2C%27GLWDMDGD%27%2C%27GMTWMDGN%27%2C%27GTBGMDGB%27%2C%27HGTWMDHG%27%2C%27HYVLMDCM%27%2C%27HYVLMDHY%27%2C%27HYVLMDRI%27%2C%27LARLMDLR%27%2C%27LDVRMDLO%27%2C%27LNHMMDLN%27%2C%27LPLTMDLA%27%2C%27LXPKMDLX%27%2C%27MAYOMDMY%27%2C%27MRBOMDMB%27%2C%27MRKKMDMK%27%2C%27MTARMDMA%27%2C%27NRPNMDNP%27%2C%27ODTNMDON%27%2C%27ODTNMDPO%27%2C%27OLNYMDOK%27%2C%27OWMLMDOM%27%2C%27OXHLMDOH%27%2C%27PARLMDPA%27%2C%27PIVLMDPK%27%2C%27PKVLMDPK%27%2C%27PLVLMDPV%27%2C%27PRHLMDPH%27%2C%27RKVLMDMR%27%2C%27RKVLMDRV%27%2C%27RKVLMDVR%27%2C%27RNTWMDRA%27%2C%27RSTWMDRS%27%2C%27SLSPMDCV%27%2C%27SLSPMDNB%27%2C%27SLSPMDNW%27%2C%27SLSPMDSS%27%2C%27STLDMDSL%27%2C%27STMRMDSM%27%2C%27SVPKMDSP%27%2C%27TMHLMDTH%27%2C%27TWSNMDTW%27%2C%27UNKNOWN%27%2C%27UPMRMDCC%27%2C%27WDLWMDWL%27%2C%27WDRFMDWD%27%2C%27WHMRMDWM%27%2C%27WHTNMDWT%27%2C%27WNRNMDWN%27)&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=1222&geometry=%7B%22xmin%22%3A-8140237.764260955%2C%22ymin%22%3A3859764.1802872494%2C%22xmax%22%3A-7514065.628548957%2C%22ymax%22%3A4485936.315999246%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryEnvelope&inSR=102100&outFields=*&outSR=102100&callback=dojo.io.script.jsonp_dojoIoScript_FIOS_Wire_Centers50_1222_992452562495_6_19._jsonpCallback

As you can see, it's sending the request directly as a GET to the arcgisserver instead of POST to the proxy page.

Outcomes