Limiting proxy use

1072
2
01-08-2013 10:28 AM
BethBrennan
New Contributor
I have a website that allows users to add map services. If the map service is within a specified domain, I want it to use the proxy and if it is not, I want it to call the service directly. The services on the specified domain are secured and the proxy is used to request it with the correct credentials. I have implemented this by setting alwaysUseProxy to true. I use esri.setRequestPreCallback and if the requested url is not in the specified domain, I remove the proxy's prefix from the url.

The problem is that when I add the service to the map, all tiles are requested through the proxy. Does anyone know of a work around for this? My proxy will be on a server that will only have access to the specified domain. Thank you.
0 Kudos
2 Replies
BethBrennan
New Contributor
Here is what I am using:

esri.config.defaults.io.proxyUrl = "../../proxy.ashx";
              esri.config.defaults.io.alwaysUseProxy = true;
            esri.setRequestPreCallback(function(ioArgs) {             
              if(ioArgs.url.toLowerCase().search(".bar.com")  == -1 ) {
              
                ioArgs.url = ioArgs.url.replace("../../proxy.ashx?", "");
              }
              return ioArgs;
            });
0 Kudos
BrettBattles1
New Contributor
I tried this on our Windows Authenticated services.

  • It worked for "reads"

  • But it is failing for feature layer updates.  I'm getting a 401 when trying to do feature layer updates (looks like POST).

0 Kudos