Before we get into the actual mechanics of working with the proxy page and CORS, let’s briefly outline what problem they are trying to solve.
- Your browser must support it. Many modern browsers do, but you can check yours at http://caniuse.com/#feat=cors
- The server that hosts the resource that you want must also support CORS. ArcGIS Server 10.1 and above supports CORS out of the box, but there are still many servers out there (including some of Esri’s own servers) that don’t.
Assuming both these things are in place, then you are good to go. If you cannot rely on CORS, then you need to install and configure a proxy page on your web server. Instead of sending the request for the remote resource directly to the web server that hosts it, your application sends the request to the proxy page on your server first, and the proxy then forwards the request to the remote server. It then relays the response returned by the remote server directly back to your application. Because the connection is made to your server, and the data from the resource your requested comes back from your server, the browser does not complain about your web application and the resource that you are interacting with being on different hosts. It’s really that simple! So now you know how the proxy works, and all you need to do is pick the right one for your web server, configure it, and tell your application where it is. Thankfully, Esri’s documentation on that is really good. Hopefully the time will come when everything supports CORS, but until then you need to make provision for those browsers and ArcGIS servers that don’t by using the proxy page.