ArcGISTiledMapServiceLayer url with proxy how?

831
1
02-22-2017 02:37 AM
VictorKniif
New Contributor

So we have a basemap thats fetched from a url    

var basemap = new ArcGISTiledMapServiceLayer("https://examplemap.com");

The problem is that we are supposed to use a proxy to connect to this basemap. Where do you place the proxy and how?

The proxy sent to us looks approximately like this "https://randomexample.com/proxy.ashx

Best Regards

0 Kudos
1 Reply
FC_Basson
MVP Regular Contributor

You can place the proxy anywhere on your web server e.g. in the root under a folder called "proxy".  Then in your Javascript you specify which services and URLs must route through the proxy page:

esriConfig.defaults.io.proxyUrl = '/proxy/proxy.ashx';
esriConfig.defaults.io.alwaysUseProxy = false;
urlUtils.addProxyRule({
  urlPrefix: 'https://example.com',
  proxyUrl: '/proxy/proxy.ashx'
});

And in the proxy config you must specify the access credentials