Problems using Proxy.ashx with ArcGisOnline Base Map

Discussion created by brianj on Oct 3, 2013
Latest reply on Oct 3, 2013 by brianj
I have a proxy.ashx setup on the company's web server to proxy AGS requests.  It has worked fine for several months with the AGS Flex API.  Now I want to build a Javascript viewer to replace the Flex API viewer, using the same proxy.ashx.  The first thing I noticed is there is a difference between how the Flex API and the Javascript API use Proxy.ashx.  In the Flex API you set the "proxyUrl" per map service, but in the Javascript API it is a global setting for the entire application.  The Flex API works very well because you can use the proxy.ashx for internal operational layers from a company's AGS and not use the proxy.ashx for ArcGISOnline base maps.  Still, the Javascript API appears to provide a way to accomplish the same thing, but in a different way.  If I understand this correctly, I can use proxy.ashx for our internal AGS this way: = true; = ""; = "";

So I did and it works fine since I get the layers from the company AGS.  However, I don't get the ArcGISOnlie basemap layers because those requests were also proxied through the proxy.ashx, which caused them to fail. Still, the Javascript API docs say use the corsEnabledServers to fix that problem so I added this line:"");

Which solved the problem for the first request to arcgisonline, but all others after the first fail in IE, Chrome and Firefox.   Perhaps I'm doing something wrong?