Be on the same domain as the application, or Be hosted on a server that supports CORS, or. Use a proxy.
Our proxy server is written in node.js
Transparentgov.net has its own proxy server running at https://transparentgov.net:7200 for Secure Sockets Layer (SSL)
Non Secure Sockets Layer runing at http://transparentgov.net:7000.
ESRI privide other version of proxy server, such as ASP.NET, Java/JSP, PHP. You can use as well for Arcgis Server that is not enabled for CORS.