A proxy page handles communication between your application and ArcGIS Server services. The proxy is server-side code that resides on your Web Server and handles incoming requests from a browser based application. The proxy accepts the request and forwards it to ArcGIS Server for processing.
There are four basic steps to installing and configuring your proxy page. First, download and configure the proxy page for your server. This can be ASP.NET, PHP, or Java/JSP. Next, add code to your application to enable the use of the proxy. In step 3, secure your web application if you plan to use tokens. Finally, test your application to make sure the proxy is working as expected. Detailed instructions for installing and configuring your proxy page is provided by ESRI at the links provided on above.
Coding your application to use a proxy page requires only a couple lines of code. Normally you’d put this in your ‘init’ function which runs on startup. You’ll need to provide the Url for the location of the proxy page and the ‘alwaysUseProxy’ property can be set to either true or false. If your application will be using tokens you’ll want to set this value to true, but otherwise it can be set to false if you know that not all requests will need the proxy. This would be the case in an editing application or an application where only some requests would exceed the 2048 character limitation.