AnsweredAssumed Answered

IIS Proxy Issue

Question asked by glennlawr on Jun 9, 2014
I am trying to use an IIS proxy with oAuth authentication for a internal map site. I have setup my site in IIS and converted it to a .NET4 appllication for hosting the proxy and I have set the correct permissions etc. The map home page is also part of the same IIS site.

When I try to launch the site from a remote host the map doesn't load. The page tries to load as I can see the correct page title in the browser window, but the body of the page is just blank. The remote host is part of the same domain and the logged in user is an admin on the IIS server.

If I launch the site on my IIS server is loads the map and seems to work fine. I can then visit the page on my remote host and it loads the map no problem. However, if I leave it for a while and refresh the page on my remote host the same issue happens agian. If I reload the page from the IIS server it loads fine and it starts to work again on my remote host.

I can't understand what might be the issue here. Has anyone seen something like this happen before or know what the issue may be?

Below is my map home/html page amd my proxy.config file. I have the "clientId & clientSecret" set correctly in my config file.

[HTML]
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <meta name='viewport' content='initial-scale=1, maximum-scale=1,user-scalable=no'>
    <title>Create web map from id</title>

    <link rel='stylesheet' href='http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css'>
    <link rel='stylesheet' href='http://js.arcgis.com/3.9/js/esri/css/esri.css'>
    <link rel='stylesheet' href='css/layout.css'>


    <script src='http://js.arcgis.com/3.9compact/'></script>
    <script>
    require([
     'esri/urlUtils',
   'dojo/parser',
   'dojo/ready',
   'dojo/dom',
   'esri/map',
   'esri/urlUtils',
   'esri/arcgis/utils',
   'esri/dijit/Scalebar',
   'dojo/domReady!'
  ], function(
   urlUtils,
   parser,
   ready,
   dom,
   Map,
   urlUtils,
   arcgisUtils,
   Scalebar) {

    ready(function(){

     parser.parse();

     // set url to proxy
     esriConfig.defaults.io.proxyUrl  = 'proxy.ashx';

     // configure valid proxy rules
     urlUtils.addProxyRule({
      urlPrefix: "https://services.arcgis.com",
       proxyUrl: "proxy.ashx"
     });

     urlUtils.addProxyRule({
      urlPrefix: "http://www.arcgis.com",
      proxyUrl: "proxy.ashx"
     });

     // setup the map via web map ID
     arcgisUtils.createMap('7f801a9aa8334eeb9c74454e0a411454','map').then(function(response) {

      var map = response.map;

      //add the scalebar
      var scalebar = new Scalebar({
       map: map,
       scalebarUnit: 'english'
      });
     });
    });
   });
    </script>
  </head>

  <body class='claro'>
      <div id='map'></div>
  </body>
</html>
[/HTML]

<?xml version="1.0" encoding="utf-8" ?>
<ProxyConfig allowedReferers="*" mustMatch="true">
    <serverUrls>
     <serverUrl url="http://www.arcgis.com/"
      clientId="xxxxxxxxxxxx"
      clientSecret="xxxxxxxxxxxx"
      rateLimit="600"
      rateLimitPeriod="60"
      matchAll="true">
  </serverUrl>
 
  <serverUrl url="http://services.arcgisonline.com/" 
                                    clientId="id here"
                                    clientSecret="secret here"
                                    rateLimit="600"
                                    rateLimitPeriod="60"
                                    matchAll="true">
                                </serverUrl>

  
    </serverUrls>
</ProxyConfig>

<!-- See https://github.com/Esri/resource-proxy for more information. -->


Outcomes