Use Proxy page for selective pages

805
7
10-22-2012 09:01 AM
JatinPatel
Occasional Contributor
I have an app that is currently configured to use proxy for all layers, using:
esri.config.defaults.io.alwaysUseProxy = true;


Problem with that is. although it secures my featurelayers, all the layers including basemaps are routed through it which makes it slow.

Is there a way to tell the app which layers to route though proxy and which not to instead of just setting "alwaysuseproxy" to be true or false universally?
0 Kudos
7 Replies
__Rich_
Occasional Contributor III
0 Kudos
JatinPatel
Occasional Contributor
did see those, but neither one answered my questions. I do not want to go in direction of tokens.

Any suggestions?
0 Kudos
BillDaigle
Occasional Contributor III
Sounds like a perfect use case for tokens. You don't have to manage the tokens.  You could use the proxy page to dynamically generate a token and append it when you create the feature layer.  I there some reason you don't wan to go the way of tokens?
0 Kudos
__Rich_
Occasional Contributor III
did see those, but neither one answered my questions.

Your question looks like a duplicate and avoiding creating duplicate threads, if possible, is helpful.
0 Kudos
JatinPatel
Occasional Contributor
Sounds like a perfect use case for tokens. You don't have to manage the tokens.  You could use the proxy page to dynamically generate a token and append it when you create the feature layer.  I there some reason you don't wan to go the way of tokens?


We are currently using windows authentication to secure the services and that is why using proxy. Due to some reasons we cannot move away from WA. can we use WA and tokens both? Would it make sense?
0 Kudos
BillDaigle
Occasional Contributor III
I haven't worked with windows authentication, but I don't see why it wouldn't work.  As long as you pass valid credentials to the gis server, you should be able to return a valid token.  We went through a similar issue on our server. Originally, we were passing every request through the proxy and found that the application server was creating a bottle neck.  Instead, we opted to do a single token request when a user first opens the application.  You can set the token to expired after a certain amount of time -- we use 24 hours.

Here is function we use for requesting the token:
_getToken: function(onComplete){
    dojo.xhrGet({
      url: "code/getToken.jsp?&ref=" + document.location.protocol + "%2F%2F" + document.location.hostname,
      handleAs: "text",
      load: function(data){
        var jsonData = dojo.fromJson(data);
        onComplete(jsonData.token);
      },
      error: function(error){
        onComplete(error);        
      }
    });
  },
0 Kudos
JatinPatel
Occasional Contributor
Thanks!
Let me give it a shot..
0 Kudos