Thursday, December 23, 2010

Using Google App Engine as Proxy for Silverlight and Flash Cross-Domain Requests

When using Silverlight or Flash to fetch data from other domains one often runs into cross-domain access restrictions. For security reasons in order to access data from different domains, the remote server explicitly has to allow this by defining a crossdomain.xml (or, for Silverlight, clientaccesspolicy.xml is good as well). If this file cannot be found on the remote domain, the request is not executed.
This can be fustrating when querying against RSS feeds or JSON/XML web APIs that don’t define any of these files. The workaround for this issue is to use some sort of proxying service. In this article I’ll be showing how to use Google App Engine to create a simple proxy that will forward these requests for free – within a reasonable daily load.

Google App Engine Overview

The reason I’ve chose to implement the proxy using Google App Engine is because it has a free daily quota and getting started using it is really simple: all you need is a Google account and to download and install the Google App Engine SDK.
Google App Engine supports developing in both Java and Python. In my example I’ll be using Python. In order to use and deploy the code yourself as well, follow these steps:

Read more: Greg Does IT